C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Gridview


Posted Date: 04 Nov 2009      Posted By: deepa      Member Level: Silver     Points: 1   Responses: 2



Hi all,

I have one dropdown list which load data from database and there is
one update button. When I click update button the data from the dropdown
list should display in the grid view. I need coding. Please help

Thanks,
Deepa





Responses

Author: pradeep kumar reddy    04 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

hi deepa,
first we have to configure the dropdown list with the database. then we can access the data srom the database. now coming to your question u want to access data to the textbox when u click on update button. for this try the following code.



protected void button1_click()
{
foreach(listitem s in dropdownlist1.items)
{
if(s.selected)
{
textbox1.text=s.text;
}
}
}

try this code. and donot enable auto postback. because if u enable means then the selected item in dropdownlist automatically comes into the textbox irrespective of button click



Author: Hitesh Prajapati    04 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

foreach(listitem s in dropdownlist1.items)
{
grid.item.insert(new insert item(s,"0"));
}



Post Reply
You must Sign In to post a response.
Next : Login Control
Previous : Error: Input string was not in correct format
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use