R
rodchar
hey all,
given:
protected void SearchedValues2(object sender, EventArgs e)
{
if (sender is CheckBox)
{
CheckBox cb1 = (CheckBox)sender;
controlValues.Add(KeyValuePair<string, string>(cb1.ID,
cb1.Text));
}
else if (sender is DropDownList)
{
DropDownList ddl1 = (DropDownList)sender;
controlValues.Add(KeyValuePair<string, string>(ddl1.ID,
ddl1.Text));
}
else if (sender is TextBox)
{
TextBox txb1 = (TextBox)sender;
controlValues.Add(KeyValuePair<string, string>(txb1.ID,
txb1.Text));
}
}
question:
if i knew i only wanted the id and the value of the control could i shorten
the code somehow?
thanks,
rodchar
given:
protected void SearchedValues2(object sender, EventArgs e)
{
if (sender is CheckBox)
{
CheckBox cb1 = (CheckBox)sender;
controlValues.Add(KeyValuePair<string, string>(cb1.ID,
cb1.Text));
}
else if (sender is DropDownList)
{
DropDownList ddl1 = (DropDownList)sender;
controlValues.Add(KeyValuePair<string, string>(ddl1.ID,
ddl1.Text));
}
else if (sender is TextBox)
{
TextBox txb1 = (TextBox)sender;
controlValues.Add(KeyValuePair<string, string>(txb1.ID,
txb1.Text));
}
}
question:
if i knew i only wanted the id and the value of the control could i shorten
the code somehow?
thanks,
rodchar