C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Problem in displaying controls in textboxes


Posted Date: 08 Aug 2008      Total Responses: 1

Posted By: Mathi       Member Level: Silver     Points: 1



There r 100 products including image,
i want to display everything in different textbox controls and imagebutton..
i dont want to display it in gridview/datalist..like that

i used this code,where i have to specify each and every controls

int n;
String str = "Select * from productdet";
SqlDataAdapter adp = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
adp.Fill(ds);
Response.ContentType = "image/gif";
if(ds!=null)
{

lblname1.Text = ds.Tables[0].Rows[0]["dname"].ToString();
lblprice1.Text = ds.Tables[0].Rows[0]["dprice"].ToString();
imgp1.ImageUrl = ds.Tables[0].Rows[0]["dimage"].ToString();


lblname2.Text = ds.Tables[0].Rows[1]["dname"].ToString();
lblprice2.Text = ds.Tables[0].Rows[1]["dprice"].ToString();
imgp2.ImageUrl = ds.Tables[0].Rows[1]["dimage"].ToString();
}


Is there any method. otherthan this.. pls response





Responses

Author: kumar    08 Aug 2008Member Level: DiamondRating:     Points: 4

Hi,

You can write the code dynamically, instead of writing the 100 times each of the textbox and image control.

You can loop through the code and create label and image control dyanmically and add in a panel control

Thanks and regards,
Kumar



Post Reply
You must Sign In to post a response.
Next : Displaying values in controls
Previous : urgent OnDataBinding="gvAudits_DataBinding" sample code for gvAudits_DataBinding()
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use