You have a listbox where you need to deal with multiple items selected. I guess this should be very easy, but still it's worth to write about it.
Parameter p;
for (int i = 0; i < listbox.Items.Count; i++)
{
if (listbox.Items[i].Selected)
{
p = new Parameter("param", TypeCode.String, listbox.Items[i].Value);
myDS.InsertParameters.Add(p);
myDS.Insert();
myDS.InsertParameters.Remove(p);
}
}
Saturday
Command button in a Gridview
Suppose you are displaying records in a gridview and would like to create a command button where you click on and send an email to the memberID for example.
In case you are not displaying the memberID, you should use the following syntax for doing the job:
if (e.CommandName.ToString() == "cmdContact")
{
int MemberID = (int)GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value;
//then do something with the memberID value.
In case you are not displaying the memberID, you should use the following syntax for doing the job:
if (e.CommandName.ToString() == "cmdContact")
{
int MemberID = (int)GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value;
//then do something with the memberID value.
Subscribe to:
Posts (Atom)