i have 2 agent & member table it is successfully updated, but in gridview i have select radiobtnlist as agent to member means it want to add the record automatically agent to member table how ?
or tel how to modify in my codings using radiobtnlist ? my coding as below:
if (RadioButtonList1.SelectedIndex == 0)
{
else if (e.CommandName == "upd") 1
codings...... ...how ?
}
else if (RadioButtonList1.SelectedIndex == 1)
{
else if (e.CommandName == "upd") 2
codings.... //how ?
}
}//here codings...
else if (e.CommandName == "upd") 1
{
LinkButton lkbupd = (LinkButton)e.CommandSource as LinkButton;
GridViewRow row = lkbupd.NamingContainer as GridViewRow;
Label lbid = (Label)row.FindControl("lblid");
TextBox txfrdate = (TextBox)row.FindControl("txtfrdate");
TextBox txtodate = (TextBox)row.FindControl("txttodate");
TextBox txtitle = (TextBox)row.FindControl("txttitle");
TextBox txdescription = (TextBox)row.FindControl("txtdescription");
RadioButtonList txradiocategory = (RadioButtonList)row.FindControl("radiotype");
cmd=new SqlCommand("update agentoffer set fromdate='"+txfrdate.Text+"',todate='"+txtodate.Text+"',title='"+txtitle.Text+"',description='"+txdescription.Text+"',category='"+txradiocategory.SelectedItem.Text+"' where id='"+lbid.Text+"'",con);
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
Response.Write(
"Updated Successfully");
bindgrid();
}
else if (e.CommandName == "del")
{
LinkButton lnkdel = (LinkButton)e.CommandSource as LinkButton;
GridViewRow row = lnkdel.NamingContainer as GridViewRow;
Label lid = (Label)row.FindControl("lblid");
cmd = new SqlCommand("delete from agentoffer where id='" + lid.Text + "'", con);
cmd.ExecuteNonQuery();
Response.Write(
"Deleted Successfully");
bindgrid();
}
else if (e.CommandName == "Edit")
{
LinkButton lnkedit = (LinkButton)e.CommandSource as LinkButton;
GridViewRow row = lnkedit.NamingContainer as GridViewRow;
lbradio = (
Label)row.FindControl("lblcategory");
}
else if (e.CommandName == "upd") 2
{
LinkButton lkbupd = (LinkButton)e.CommandSource as LinkButton;
GridViewRow row = lkbupd.NamingContainer as GridViewRow;
Label lbid = (Label)row.FindControl("lblid");
TextBox txfrdate = (TextBox)row.FindControl("txtfrdate");
TextBox txtodate = (TextBox)row.FindControl("txttodate");
TextBox txtitle = (TextBox)row.FindControl("txttitle");
TextBox txdescription = (TextBox)row.FindControl("txtdescription");
RadioButtonList txradiocategory = (RadioButtonList)row.FindControl("radiotype");
cmd=new SqlCommand("update memoffer set fromdate='"+txfrdate.Text+"', todate='"+txtodate.Text+"', title='"+txtitle.Text+"', description='"+txdescription.Text+"', category='"+txradiocategory.SelectedItem.Text+"' where id='"+lbid.Text+"'",con);
cmd.ExecuteNonQuery();
GridView2.EditIndex = -1;
Response.Write(
"Updated Successfully");
bindgrid1();
}