I am using Grid, in my grid I have footer in that footer I have
1 dropdown list with some fixed values here each item has separate ID [Value],
1 ADD Button.
Suppose In my Dropdown I have 5 Different Items with 5 Different Ids.
So my work is that I want to select one of the dropdown item & some text in Textbox & wants to INSERT that data into DB.
Here the problem is I want to add only 5 times & I didn’t want to select the repeated item in dropdown. If by mistake I select and Click on ADD button in footer it wants to show alert message. [Sorry this Item is already exists.]
So what to do????
Can any body help me???
MY CODE GOES LIKE THIS……
MyIAID = Convert.ToInt32(MYDROPDOWN.SelectedValue.ToString());
SqlCommand cmd = new SqlCommand("MYPROCEDURE", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
if (ds != null)
if (ds.Tables.Rows.Count > 0)
for (var i = 0; i < ds.Tables.Rows.Count; i++)
int IAID =
if (IAID == MyIAID)
"<script>alert('This Record Is Already Exists.');</script>");
MY INSERTION CODE GOES HERE
Thanks in Advance,