asp.net - how to change the label1 text to block n unblock if checkbox in gridview1 is checked? -
i want if checkbox1 in gridview checked label1 text in gridview block if checkbox1 in gridview unchecked label1 text n gridview unblock ...
i want because want .... block unblock user in aspnetdb.mdf membership table. ..
whatz wrong in code :
protected sub gridview1_selectedindexchanged(byval sender object, byval e system.eventargs) handles gridview1.selectedindexchanged dim linkbutton1 linkbutton = me.gridview1.selectedrow.findcontrol("linkbutton1") dim chk checkbox = me.gridview1.selectedrow.findcontrol("checkbox1") if chk.checked = true linkbutton1.text = "block" dim user membershipuser = membership.getuser(gridview1.selectedrow.cells(1).text.tostring) 'to block specific user: user.isapproved = false membership.updateuser(user) else linkbutton1.text = "unblock" dim user membershipuser = membership.getuser(gridview1.selectedrow.cells(1).text.tostring) 'to block specific user: user.isapproved = true membership.updateuser(user) end if end sub
check in backend if updating user. if not, there bigger issues here. how binding grid, every page load, or on initial page load , during updates?
does text changed first time posts back, reverts on future postbacks? may text switch block unblock not automatically saves viewstate. therefore, may need reassign whether blocked or unblocked linkbutton text on every postback, in rowcreated...
could provide more information isn't working?
hth.
Comments
Post a Comment