asp.net - Getting textbox and checkbox values which is in edit item template of gridview in a string -
this vb.net code update name of person booked car , whether wants ac or non ac car handled checkbox. when click on edit button in gridview. textbox edit person , checkbox select car ac type. after clicking on update textbox code not retrieving edited textbox value, taking binded textbox value. suppose if i'm editing mathew john, takes mathew doesnot take value of john. checkbox, if check checkbox. checked attribute of checkbox showing false. please me this.
protected sub gvbooking_rowupdating(byval sender object, byval e system.web.ui.webcontrols.gridviewupdateeventargs) handles gvbooking.rowupdating dim name string = directcast(gvbooking.rows(e.rowindex).findcontrol("txtperson1"), textbox).text dim id integer = integer.parse(gvbooking.datakeys(e.rowindex).value.tostring) dim carac string = "false" dim chk checkbox = ctype(gvbooking.rows(e.rowindex).findcontrol("checkbox1"), checkbox) if (chk.checked = true) carac = "true" end if dim sql string = "" sql = "update dbo.tbl_book set person_name='" + name + "',ac_type='" + carac + "' booking_id = " + id.tostring gc.executecommand(sql) gvbooking.editindex = -1 gc.bindgridview(gvbooking, "select * tbl_book") end sub
check have bind grid view in page load outside page post property
Comments
Post a Comment