简体   繁体   中英

asp.net gridview with drop down , text box and checkbox

In a user contorl I need to have a asp.net grid view with dropdown,text box and checkboxes , whose values may be mapped from database if it exist or it will be loaded as a default control. Then once user makes it seclection I need to save the selected values in databse. 在此处输入图片说明

see the message below. This is how the grid view needs to look like: Does any one have an example of some thing similar implemented???

I would have a button outside the grid that says "Save" onclick it loops in a foreach gridview row and gets the value of each dropdown, textbox, checkbox and saves to the database.

foreach(GridViewRow row in gvMyGrid.Rows)
{
    DropDownList ddl1 = (DropDownList)row.FindControl("ddl1");
    //code here to save this value
}

something like that, i use it all the time and works like a charm.

there's also a way to postback from any control in your grid and do something with it, check it out, adsanti.wordpress.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM