hello,
i have a form where there are multiple dropdown lists that will all be populated from the same initial data query.
i have a vb class defined to make the stored proc call and that returns a dataset. in my codebehind, i have in an "If Not Page.IsPostBack" block with statements that populate each of the dropdown lists. there could be up to 10 dropdowns lists used, which means the current way i'm doing it i'd have 10 sets of the same code, only difference would be the drop down object name.
is this the only way to do this? would be nice to reuse the results somehow, not have to call the stored proc function each time.
myDBclass is only dimensioned once, but the code sets will be repeated up to 10 times
each "set" of code is:
drop1.DataSource = myDBclass.GetNames(groupID)
drop1.DataTextField = "Name"
drop1.DataValueField = "UserId"
drop1.DataBind()
drop2.......
drop3.......
etc
have another question related to my handling of these very similar dropdown lists
what is a syntax example for using dynamic code to reference object names - i assume you do this?
example psuedo code...
while i < 11
loop
"drop"+i.SelectedIndex = 0
i = i + 1
end loop
new to vb/asp.net. thanks very much for any help!
i have a form where there are multiple dropdown lists that will all be populated from the same initial data query.
i have a vb class defined to make the stored proc call and that returns a dataset. in my codebehind, i have in an "If Not Page.IsPostBack" block with statements that populate each of the dropdown lists. there could be up to 10 dropdowns lists used, which means the current way i'm doing it i'd have 10 sets of the same code, only difference would be the drop down object name.
is this the only way to do this? would be nice to reuse the results somehow, not have to call the stored proc function each time.
myDBclass is only dimensioned once, but the code sets will be repeated up to 10 times
each "set" of code is:
drop1.DataSource = myDBclass.GetNames(groupID)
drop1.DataTextField = "Name"
drop1.DataValueField = "UserId"
drop1.DataBind()
drop2.......
drop3.......
etc
have another question related to my handling of these very similar dropdown lists
what is a syntax example for using dynamic code to reference object names - i assume you do this?
example psuedo code...
while i < 11
loop
"drop"+i.SelectedIndex = 0
i = i + 1
end loop
new to vb/asp.net. thanks very much for any help!