Hey do this but now i face the main problem,here is the my code,
for create control i use this method:
private void generateDynamicControls()
{
int rowCount=Convert.ToInt32(Session["rc"]);
for (int i = 0; i < rowCount; i++)
{
TextBox txtfirstname = new TextBox();
TextBox txtlastname = new TextBox();
TextBox txtemail = new TextBox();
RadioButton chkmale = new RadioButton();
RadioButton chkfemale = new RadioButton();
txtfirstname.ID = "txtfirstname" + i.ToString();
txtlastname.ID = "txtlastname" + i.ToString();
txtemail.ID = "txtemail" + i.ToString();
txtfirstname.CssClass = "form-control";
txtlastname.CssClass = "form-control";
txtemail.CssClass = "form-control";
txtemail.Text = "E-Mail Address";
txtfirstname.Text = "First Name";
txtlastname.Text = "Last Name";
chkmale.ID = "chkmale" + i.ToString();
chkfemale.ID = "chkfemale" + i.ToString();
chkmale.Text = "Male";
chkfemale.Text = "Female";
pnll.Controls.Add(txtfirstname);
pnll.Controls.Add(txtlastname);
pnll.Controls.Add(txtemail);
pnll.Controls.Add(chkmale);
pnll.Controls.Add(chkfemale);
}
}
for save it's value i use this method,
protected void Submit(object sender, EventArgs e)
{
int rccount = Convert.ToInt32(Session["rc"]);
string strValue1 = string.Empty;
string strValue2 = string.Empty;
string strValue3 = string.Empty;
ExtraInviteeBL eb = new ExtraInviteeBL();
for (int i = 0; i < rccount; i++)
{
string firstname = "txtfirstname" + i.ToString();
string lastname = "txtlastname" + i.ToString();
string mail = "txtemail" + i.ToString();
TextBox tb = pnll.FindControl(firstname) as TextBox;
TextBox tb1 = pnll.FindControl(lastname) as TextBox;
TextBox tb2 = pnll.FindControl(mail) as TextBox;
strValue1 += tb.Text + "\n";
strValue2 += tb.Text + "\n";
strValue3 += tb.Text + "\n";
eb.First_Name = strValue1;
eb.Last_Name = strValue2;
eb.E_mailID = strValue3;
eb.Ive_Invited_By = Convert.ToInt32(Session["invitedby"]);
}
eb.insert();
}
now all records save only in one id,in table i have guest table,and it contain guestid,which is primary key.
it increment automatically then how i save it's value as per for loop increases,
(i mean i's value increment)
give me suggestion please
Thanks in advance.