ID | Type |
1 | PC |
2 | Labtop |
3 | KeyBoard |
and so on I need to save only the selected Id's to the main Table .
ID | Type |
1 | PC |
2 | Labtop |
3 | KeyBoard |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Upamanyu Roy Choudhury146 reputationPosted Feb 20, 2013, 3:15 AM EST
To generate serial number typewise your need to store the types in the array and then contact it with the couner.
serial = type + "_" + counter;
As far as the selection and insert is concerned I have written a piece of code for you
Please find the attached.
Table item_master contains theree columns
I have gien a snapshot of the table schema...this is only a sample code.
Go throught it and let me know.
Rishikesh Kumar SinghRank #1,250 · 1.4K reputationPosted Feb 17, 2013, 10:02 PM EST
if(CheckBox1.checked==true)
{
return 1; //or do whatever you want
}
if(CheckBox2.checked==true)
{
return 2; //or do whatever you want
}
if(CheckBox3.checked==true)
{
return 3; //or do whatever you want
}
i think u will get an idea for ur need...if it helps you then mark it as accepted answer otherwise let me know..i will send you the complete code..
Mayur GujrathiRank #666 · 3.6K reputationPosted Feb 18, 2013, 1:24 AM EST
{
CheckBox box = Rows.FindControl("chkSelect");
if(box.Checked)
{
//Logic to insert the row
int id= Convert.ToInt32(GridView1.Rows.Cells[0].Text); //it does not have column value
//here insert id value in database..
}
}
ToBe152 reputationPosted Feb 19, 2013, 12:49 PM EST
Thank you Rishikesh K Singh for your reply I want to return the value in the Database not 1 or 2 I want it to be like this
return ID value from the Database and I when I tried to return 1 it give me an syntax error "return keyword must not be followed by an object expression".
also I need to Know how to implement an incremental serial number based on the chosen dropdown item for example I have a dropdown menu for the type so If I have the selected Item is Device my serial number should gives me Device-001 and If selected Accessories it should give me Accssories-001 and again if select the type Accessories serial will be Accsseroies-002 and so on but when i did it keeps incremented so it will give device-oo1 and then accessories-002 and then device -003 ! want each serial number for each type to be incremented separated from the other type