vb.net - Get ID from dynamically generated LinkButton -


i generating button dynamically in code behind , assign id database table.

dim subjectlinkbutton linkbutton = new linkbutton() subjectlinkbutton.attributes.add("id", doc.inboxid) subjectlinkbutton.text = doc.receivedsubject addhandler subjectlinkbutton.click, addressof subjectlinkbutton_click 

when click on button, use

dim btn linkbutton = directcast(sender, linkbutton) me.debugtest.innertext = "button id:" & btn.id 

i error: object reference not set instance of object. @ inbox.subjectlinkbutton_click(object sender, eventargs e)

changed attributes.add

        subjectlinkbutton.commandname = "inbox_id"         subjectlinkbutton.commandargument = doc.inboxid 

and

        dim btn linkbutton = directcast(sender, linkbutton)         me.debugtest.innertext = "button: " & btn.commandname & " " & btn.commandargument 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -