does anyone have time to explain how to submit seperate values from my checkbox list?
I would be muchly appreciative.
so far I have the first boxes value returning, I realise it has to go in the if/foreach loop to make a value for each one but when I put my sql command in there it can't be recognized...
please help!!
-Matt
You can store the variables's values in an array, and then submit it.SqlCommand cmdInterest;
cmdInterest = new SqlCommand( "Insert tbl_interests ( interestID ) Values (@dotnet.itags.org.interestID) ", conform );
//check box item testing
foreach (ListItem itmInterest in chkl_interests.Items)
{if (itmInterest.Selected){
//now I have no idea what to put here??
}
}cmdInterest.Parameters.Add( "@dotnet.itags.org.interestID", chkl_interests.SelectedItem.Value );
conform.Open();
cmdInsert.ExecuteNonQuery();
cmdInterest.ExecuteNonQuery();conform.Close();
string[] names = new string[5];
int i = new int();
for each (ListItem itmInterest in chkl_interests.Items)
{
names[i] = chkl_interests.Items.tostring();
i++;
}
then in the pre-render event, just store the value before you submit it.
viewstate("names") = names;
to pass its value to the client do this:
response.write("<script language=""Javascript""> ")
response.write("var array[5]; ")
response.write("array = " + names + "; ")
response.write("</script>")
I dont know if this will help you, but i dont really know what do you want.
0 comments:
Post a Comment