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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Upamanyu Roy ChoudhuryPosted Feb 20, 2013, 8:15 AM
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.
ToBePosted Feb 19, 2013, 5:49 PM
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
Mayur GujrathiPosted Feb 18, 2013, 6:24 AM
{
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..
}
}
Rishikesh Kumar SinghPosted Feb 18, 2013, 3:02 AM
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..