c# - Reference a user control by name in code behind (dynamically created) -


i created checkbox using method below:

for( = 1; i<7; i++)     {         (j = 1; j < 33; j++)         {             checkbox = new checkbox();             a.name = "sat_id_" + i.tostring() + "_" + j.tostring();             this.sat_id_grid.children.add(a);             a.style = (style)application.current.findresource("readonlycheckbox");             grid.setrow(a, );             grid.setcolumn(a, j );         }     } 

is possible reference checkboxes later using "sat_id_x_y"? cant seem find solution. if not how can reference them? need change .ischecked state.

thanks

just store references controls somewhere instead of names, e.g. in list<checkbox>, can access them index.

also should not of that, use data-templating , data-binding create controls data. if done right need change boolean on data , check-box checked/unchecked.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -