Getting the bound Datarow of a Datagrid on postback in ASP.NET 4 -


i want find out bound datarow or datatable of datagrid on postback. have buttoncolumn in grid. on click of button, i'm trying determine datarow can access primary key , pass page. primary key not bound , therefore not visible in row.

for example have list of customers, edit button. on clicking of edit button, want open customeredit.aspx?id=10. able trap click event on server side in datagridcustomer_itemcommand event. not able access datarow of e.item.itemindex.

on postback i'm not binding datagrid. on accessing datagridcustomer.datasource, "nothing". there way datasource or datarow?

thanks

you can't. databind method calling page load method, when it's not postback iterate through source build controls. after that, source not kept...only resulting controls.

i suggest build url edit page instead of relying on postback.

in few words, create hyperlinkcolumn in datagrid, , specify text fields , datafields build full url.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -