P
Paul W
i have some dynamic controls that i add to a webform (actually, i dynamiclly
build a table and add the controls to cells). some of these controls are
HtmlSelect controls with the multiple property set to true.
i have figured out how to loop through the controls on the form and find the
one i am looking for. when i go to get the values out of it, it only gives
me the fist value. for instance, if i have "a", "b", and "c", when i do the
loop through arr2 (see code below), it only has a length of 1 and it only
has the first value in the list. I need to get to all values in the
htmlselect control. how can i do this? thanks. //Paul
private void btnSaveAs_Click(object sender, System.EventArgs e)
{
....... other code
int loop1, loop2;
string paramValues = '";
System.Collections.Specialized.NameValueCollection coll;
// Load ServerVariable collection into NameValueCollection object.
coll=Request.Params;
// Get names of all keys into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
string s = arr1[loop1];
if(s == "cmbMediaType")
{
String[] arr2=coll.GetValues(arr1[loop1]);
for (loop2 = 0; loop2 < arr2.Length; loop2++)
{
paramValues += arr2[loop2] + "|";
//Response.Write("Value " + loop2 + ": " + arr2[loop2] +
"<br>");
}
}
}
..... other code
}
build a table and add the controls to cells). some of these controls are
HtmlSelect controls with the multiple property set to true.
i have figured out how to loop through the controls on the form and find the
one i am looking for. when i go to get the values out of it, it only gives
me the fist value. for instance, if i have "a", "b", and "c", when i do the
loop through arr2 (see code below), it only has a length of 1 and it only
has the first value in the list. I need to get to all values in the
htmlselect control. how can i do this? thanks. //Paul
private void btnSaveAs_Click(object sender, System.EventArgs e)
{
....... other code
int loop1, loop2;
string paramValues = '";
System.Collections.Specialized.NameValueCollection coll;
// Load ServerVariable collection into NameValueCollection object.
coll=Request.Params;
// Get names of all keys into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
string s = arr1[loop1];
if(s == "cmbMediaType")
{
String[] arr2=coll.GetValues(arr1[loop1]);
for (loop2 = 0; loop2 < arr2.Length; loop2++)
{
paramValues += arr2[loop2] + "|";
//Response.Write("Value " + loop2 + ": " + arr2[loop2] +
"<br>");
}
}
}
..... other code
}