asp.net - Event of dynamically created Control not firing -


i'm having problem web control dynamically created , inserted in page. create couple of linkbuttons, depending on data of search made, , i'm trying add event handler each of buttons, filter result.

the controls initialized properly, event never fired.

private sub page_init(byval sender system.object, byval e system.eventargs) handles mybase.init   controls.clear()    dim btn controls.localizablelinkbutton   each element generic.keyvaluepair(of string, resultfilterdata) in m_list      btn = new localizablelinkbutton     btn.id = m_name & "$lnk" & count     btn.label = element.value.label.append(" (" + cstr(element.value.count) + ")")     btn.commandargument = element.value.key     addhandler btn.click, addressof me.btn_click      controls.add(btn)   next end sub 

since code in page_init controls should recreated on postback. (the localizablelinkbutton extension of linkbutton add multilingual features text).

the problem method btn_click never called. link buttons initialized on callback, same id's before. event doesn't fire.

i'm using asp.net 2.0

any ideas?

i figured out problem asp.net had link buttons.

the error in using '$' sign in id each linkbutton. asp.net apparently uses $ sign build control hierarchy when creates postback javascript. therefore thinks linkbuttons nested within control not exist. , events aren't fired of course.

once removed $ signs worked properly.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -