how I save dynamically created Labels and Checkboxes values into sql server - c#

how I save dynamically created Labels and Checkboxes values into sql server
protected void EventDuration_DDL_SelectedIndexChanged(object sender, EventArgs e)
{
int n = Int32.Parse(EventDuration_DDL.SelectedItem.ToString());
for (int i = 0; i < n; i++)
{
Label NewLabel = new Label();
NewLabel.ID = "Label" + i;
var eventDate = Calendar1.SelectedDate.Date.AddDays(i);
NewLabel.Text = eventDate.ToLongDateString();
CheckBox newcheck = new CheckBox();
newcheck.ID = "CheckBox" + i;
this.Labeldiv.Controls.Add(new LiteralControl("<span class='h1size'>"));
this.Labeldiv.Controls.Add(NewLabel);
this.Labeldiv.Controls.Add(new LiteralControl("</span>"));
this.Labeldiv.Controls.Add(new LiteralControl("<div class='make-switch pull-right' data-on='info'>"));
this.Labeldiv.Controls.Add(newcheck);
this.Labeldiv.Controls.Add(new LiteralControl("</div>"));
this.Labeldiv.Controls.Add(new LiteralControl("<br/>"));
}
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
con.Open();
SqlCommand cmd1 = new SqlCommand("insert into Event(EventName,StartDate,EventDuration,StartTime,EndTime,SlotDuration) output inserted.EventId values(#EventName,#StartDate,#EventDuration,#StartTime,#EndTime,#SlotDuration)", con);
cmd1.Parameters.AddWithValue("#EventName", EventName_TB.Text);
cmd1.Parameters.AddWithValue("#StartDate", StartDate_TB.Text);
cmd1.Parameters.AddWithValue("#EventDuration", EventDuration_DDL.Text);
cmd1.Parameters.AddWithValue("#StartTime", StartTime_DDL.Text);
cmd1.Parameters.AddWithValue("#EndTime", EndTime_DDL.Text);
cmd1.Parameters.AddWithValue("#SlotDuration", SlotDuration_DDL.Text);
Int32 id = (Int32)cmd1.ExecuteScalar();
var label = Labeldiv.FindControl("Label1") as Label;
var checkbox = Labeldiv.FindControl("CheckBox1") as CheckBox;
using (SqlCommand cmd2 = new SqlCommand("insert into EventDays(EventDay,EventStatus)values(#EventDay,#EventStatus)", con))
{
int n = Int32.Parse(EventDuration_DDL.SelectedItem.ToString());
for (int i = 0; i < n; i++)
{
var paramDay = cmd2.Parameters.Add("#EventDay", SqlDbType.DateTime);
var paramStatus = cmd2.Parameters.Add("#EventStatus", SqlDbType.Int);
paramDay.Value = label.Text;
paramStatus.Value = checkbox.Checked ? 1 : 0;
cmd2.ExecuteNonQuery();
}
}
con.Close();
}
I have created Labels and CheckBoxes dynamically in EventDuration_DDL_SelectedIndexChanged.
now I want to save these values into sql server in Wizard1_FinishButtonClick.
how I save dynamically created Labels and Checkboxes values into sql server
.
.
.
.
..

You have to recreate those dynamically created labels and check boxes for the button click as well, because when the user clicks the finish button, that causes a post back to the server and the page is recreated, but the dynamic label and check box logic is not executed, thus your database saving logic cannot "find" these controls.
I recommend moving your dynamic label and check box creation logic to a separate method that can be called by the EventDuration_DDL_SelectedIndexChanged() and Wizard1_FinishButtonClick(), like this:
private void BuildDynamicControls()
{
int n = Int32.Parse(EventDuration_DDL.SelectedItem.ToString());
for (int i = 0; i < n; i++)
{
Label NewLabel = new Label();
NewLabel.ID = "Label" + i;
var eventDate = Calendar1.SelectedDate.Date.AddDays(i);
NewLabel.Text = eventDate.ToLongDateString();
CheckBox newcheck = new CheckBox();
newcheck.ID = "CheckBox" + i;
this.Labeldiv.Controls.Add(new LiteralControl("<span class='h1size'>"));
this.Labeldiv.Controls.Add(NewLabel);
this.Labeldiv.Controls.Add(new LiteralControl("</span>"));
this.Labeldiv.Controls.Add(new LiteralControl("<div class='make-switch pull-right' data-on='info'>"));
this.Labeldiv.Controls.Add(newcheck);
this.Labeldiv.Controls.Add(new LiteralControl("</div>"));
this.Labeldiv.Controls.Add(new LiteralControl("<br/>"));
}
}
Now in your event handlers, you can call this method, like this:
protected void EventDuration_DDL_SelectedIndexChanged(object sender, EventArgs e)
{
BuildDynamicControls();
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
BuildDynamicControls();
}
Alternatively, you can call BuildDynamicControls() in the Page_Load. This takes care of other buttons on the page destroying the values when they cause a post back, like this:
protected void Page_Load(object sender, EventArgs e)
{
// Do other page load logic here
BuildDynamicControls();
}
Note: If you go this route, then you will not need to call BuildDynamicControls() in the EventDuration_DDL_SelectedIndexChanged() or Wizard1_FinishButtonClick() methods, because the Page_Load happens before either of those events in the page life-cycle.

Related

How to assign Tab Pages dynamically and add a single text box to store the data from text box into the database using c#

So I am creating forms using Visual Studio .NET.
I am stuck when I try to add tab pages dynamically on a button click which creates a text box in a new tab.
When I create multiple tabs I want to get the data from the text boxes of each newly created tabs and add it to the database. I am having problems as these text boxes have the same name as I create them dynamically. I am new to C# and I need help.
public void add()
{
aa.Add(txt.Text);
var a = 1;
var newTabPage = new TabPage()
{
Text = "Page"
};
txt = new System.Windows.Forms.TextBox();
this.tabControl1.TabPages.Add(newTabPage);
newTabPage.Controls.Add(this.txt);
System.Windows.Forms.Label lbl = new System.Windows.Forms.Label();
newTabPage.Controls.Add(lbl);
lbl.Text = "New";
txt.Name = "Get";
lbl.AutoSize = true;
lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
lbl.Location = new System.Drawing.Point(7, 389);
lbl.Name = "label263";
lbl.Size = new System.Drawing.Size(871, 13);
lbl.TabIndex = 317;
lbl.Text = "AA";
newTabPage.Controls.Add(lbl);
}
private void txt_TextChanged(object sender, EventArgs e)
private void button1_Click_1(object sender, EventArgs e)
{
add();
string value = txt.Text;
aa.Add(value);
}
private void saveToolStripMenuItem2_Click(object sender, EventArgs e)
{
SqlCommand command;
string insert1 = #"insert into testing(test) values(#testingt)";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
conn.Open();
for(int i= 0;i<aa.Count;i++)
{
if (aa[i]!= "" && aa[i]!="New Box")
{
command = new SqlCommand(insert1, conn);
command.Parameters.AddWithValue(#"testingt", aa[i]);
command.ExecuteNonQuery();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Maybe you can set the Name property to distinguish them when you create them by creating an increment variable.
int pagecount = 1;
private void btAddtab_Click(object sender, EventArgs e)
{
TabPage tabPage = new TabPage
{
Name = "Tabpage" + pagecount.ToString(),
Text = "Tabpage" + pagecount.ToString()
};
TextBox textBox = new TextBox
{
Name = "TextBox" + pagecount.ToString()
};
tabPage.Controls.Add(textBox);
tabControl1.TabPages.Add(tabPage);
pagecount++;
}
As for how to get the value of the specified TextBox, you can refer to the following code.
private void btGetValue_Click(object sender, EventArgs e)
{
foreach (TabPage page in tabControl1.TabPages)
{
foreach (Control control in page.Controls)
{
// get the first textbox's value
if (control is TextBox && control.Name == "TextBox1")
{
Console.WriteLine(((TextBox)control).Text);
}
}
}
}

C# showing double output

public partial class Questions : System.Web.UI.Page
{
private bool InstanceFieldsInitialized = false;
private Questions()
{
if (!InstanceFieldsInitialized)
{
InitializeInstanceFields();
InstanceFieldsInitialized = true;
}
}
private void InitializeInstanceFields()
{
r = User.Identity.Name;
}
private ArrayList #params = new ArrayList();
string r;
private ArrayList pklist = new ArrayList();
//Dynamically Loads the Questions based off of the table.
protected void Page_Load(object sender, System.EventArgs e)
{
//Questions Loaded
string proc = "Question_Select";
SqlConnection QuestionsConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Feedback-ConnectionString"].ConnectionString);
SqlCommand QuestionsCommand = new SqlCommand(proc, QuestionsConnection);
QuestionsCommand.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(QuestionsCommand);
DataTable vTable = new DataTable();
da.Fill(vTable);
Table detailsTable = new Table();
detailsTable.CellSpacing = 10;
var i = 0;
foreach (DataRow row in vTable.Rows)
{
var value = vTable.Rows[i][0].ToString();
TableRow tRow = new TableRow();
TableCell tCell1 = new TableCell();
TableCell tCell2 = new TableCell();
var pk = vTable.Rows[i][1].ToString();
pklist.add(pk);
Label myLabel = new Label();
myLabel.CssClass = "bold";
TextBox myText = new TextBox();
myText.TextMode = TextBoxMode.MultiLine;
myText.Columns = 40;
myText.Rows = 4;
myText.ID = "Box" + i;
#params.add(myText.ID);
myLabel.Text = string.Format("{0}. {1}", i + 1, value);
tCell1.Controls.Add(myLabel);
tCell2.Controls.Add(myText);
tRow.Cells.Add(tCell1);
tRow.Cells.Add(tCell2);
detailsTable.Rows.Add(tRow);
i += 1;
}
Panel1.Controls.Add(detailsTable);
}
//INSTANT C# WARNING: Strict 'Handles' conversion only applies to fields declared in the same class - the event will be wired in 'SubscribeToEvents':
//ORIGINAL LINE: Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
protected void Button1_Click(object sender, EventArgs e)
{
//When a survey is completed, this method checks to see who completed the survey and insert them into a table.
string proc2 = "User_Insert";
SqlConnection ResponsesConnection2 = new SqlConnection(ConfigurationManager.ConnectionStrings["Feedback-ConnectionString"].ConnectionString);
SqlCommand ResponsesCommand2 = new SqlCommand(proc2, ResponsesConnection2);
ResponsesCommand2.CommandType = CommandType.StoredProcedure;
ResponsesCommand2.Parameters.AddWithValue("#UserName", r);
ResponsesConnection2.Open();
ResponsesConnection2 = (SqlConnection)ResponsesCommand2.ExecuteScalar();
// Establish connection and set up command to use stored procedure
string proc = "Responses_Insert";
SqlConnection ResponsesConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Feedback-ConnectionString"].ConnectionString);
SqlCommand ResponsesCommand = new SqlCommand(proc, ResponsesConnection);
ResponsesCommand.CommandType = CommandType.StoredProcedure;
ResponsesConnection.Open();
<--HERE IS WHERE I THINK THE PROBLEM IS-->
***var i = 0;
for (int a = 0; a < #params.ToString().Count(); a++)
{
ResponsesCommand.Parameters.Clear();
TextBox textbox = Panel1.FindControl(#params.ToString().ElementAt(a).ToString()) as TextBox;
ResponsesCommand.Parameters.AddWithValue("#QuestionID", pklist.ToString().ElementAt(i).ToString());
ResponsesCommand.Parameters.AddWithValue("#response", textbox.Text);
ResponsesCommand.Parameters.AddWithValue("#UserName", r);
ResponsesConnection = (SqlConnection)ResponsesCommand.ExecuteScalar();
i += 1;***
}
Microsoft.VisualBasic.Interaction.MsgBox("Thank you for completing the survey.", Microsoft.VisualBasic.MsgBoxStyle.MsgBoxSetForeground, "Survey Complete");
Response.Redirect("../../../Default.aspx");
}
//Button to see if a person has chosen to be marked annonymous.
//INSTANT C# WARNING: Strict 'Handles' conversion only applies to fields declared in the same class - the event will be wired in 'SubscribeToEvents':
//ORIGINAL LINE: Protected Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles Checkbox1.CheckedChanged
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (Checkbox1.Checked == false)
{
r = User.Identity.Name;
}
else
{
r = "Anonymous";
}
}
}
}
I need a little help. My code shows double output when ran. Had multiple choices to use var, object, or dynamic using code converters. Chose var but it still outputs double. When debugger is ran shows no errors.
I would question whether you need .ToString() in the following (in the for loop):
a < #params.ToString().Count()
It seems like you probably just want the number of items in the #params list, so try replacing the above with the following:
a < #params.Count
That may fix your problem of the loop executing the wrong number of times. If so, then similarly within the loop body you probably shouldn't be using .ToString() in either of these:
#params.ToString().ElementAt(a)
pklist.ToString().ElementAt(i)
If your loop still seems to be executing too many times, then you should try stepping through it in the debugger or adding print statements (Console.WriteLine) to print the variable values for each iteration of the loop and better understand what it's doing.

Dynamically added button is not firing event and is losing state dispite re-adding it in pre_init event

I have a dropdown which is bound to a database. On its index change there is a function that add some button in a panel based upon selected value.
I am reading those button in page_init event but still I get null values, i.e. event bound with the button never fires.
Here is my code and dropdownlist1 is the dropdown that is adding dynamic button.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
colorgroupsTableAdapters.master_color_groupTableAdapter ta
= new colorgroupsTableAdapters.master_color_groupTableAdapter();
DataTable dt = ta.GetData();
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = dt.Columns[1].ToString();
DropDownList1.DataValueField = dt.Columns[0].ToString();
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("Select One", "0"));
}
}
protected void Page_Init(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
bindcolors();
}
}
protected void DropDownList1_DataBound(object sender, EventArgs e)
{
}
protected void DropDownList2_DataBound(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex < 1)
{
DropDownList2.Items.Clear();
}
DropDownList2.Items.Insert(0, new ListItem("Select One", "0"));
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
ViewState["dd"] = DropDownList1.SelectedIndex;
bindcolors();
}
void bindcolors()
{
if (DropDownList1.SelectedIndex > 0)
{
addcolorgroupsTableAdapters.groupavailablecolorTableAdapter ta
= new addcolorgroupsTableAdapters.groupavailablecolorTableAdapter();
DataTable dt = ta.GetData(int.Parse(DropDownList1.SelectedValue));
HtmlTable ht = new HtmlTable();
ht.Width = "90%";
ht.Border = 1;
for (int i = 0; i < dt.Rows.Count; i++)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tc1 = new HtmlTableCell();
HtmlTableCell tc2 = new HtmlTableCell();
HtmlTableCell tc3 = new HtmlTableCell();
object[] ob = dt.Rows[i].ItemArray;
tc1.InnerHtml = ob[0].ToString();
tc2.InnerHtml = ob[1].ToString();
tc2.BgColor = "#" + ob[1].ToString();
Button b = new Button();
b.Text = "Remove";
b.CommandArgument = ob[0].ToString();
AjaxControlToolkit.ConfirmButtonExtender cb
= new AjaxControlToolkit.ConfirmButtonExtender();
cb.ConfirmText = "Are You Sure To Delete This Color From The Group?";
b.ID = "Bo" + ob[0].ToString();
b.EnableViewState = true;
b.Click += new EventHandler(b_Click);
cb.TargetControlID = "Bo" + ob[0].ToString();
tc3.Controls.Add(b);
tc3.Controls.Add(cb);
tr.Cells.Add(tc1);
tr.Cells.Add(tc2);
tr.Cells.Add(tc3);
ht.Rows.Add(tr);
}
Panel1.Controls.Add(ht);
}
}
void b_Click(object sender, EventArgs e)
{
Button b = (Button)sender;
int grp = int.Parse(DropDownList1.SelectedValue);
int clid = int.Parse(b.CommandArgument);
addcolorgroupsTableAdapters.QueriesTableAdapter ta
= new addcolorgroupsTableAdapters.QueriesTableAdapter();
ta.DeleteQuery_group_color(grp, clid);
DropDownList2.DataBind();
bindcolors();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex > 0 && DropDownList2.SelectedIndex > 0)
{
int grp = int.Parse(DropDownList1.SelectedValue);
int clid = int.Parse(DropDownList2.SelectedValue);
addcolorgroupsTableAdapters.QueriesTableAdapter ta
= new addcolorgroupsTableAdapters.QueriesTableAdapter();
ta.Insert_into_group_color(grp, clid);
DropDownList2.DataBind();
bindcolors();
}
}
Please tell what I am doing wrong?
I think the problem is the check for SelectedIndex > 0 in bindControls. The reason is that ViewState is evaluated between the Init and Load so the value for the SelectedIndex property is not set yet (and therefore = -1).
You could try a different approach: use a Repeater control that is databound to the results of the database query. This way, the general structure can be defined in the Repeater and its ItemTemplate. Also the EventHandlers are registered in the ItemTemplate.
You can reset the DataSource of the Repeater whenever the SelectedIndex of the Combobox changes and do not need to recreate the controls dynamically in init.
Your code should be much shorter and behave more deterministic.

Grab user input from dynamic text box

I have two buttons. One button that creates the Textbox and another that submits the information. I'm having trouble retrieving the users texts once the textbox has been created. Here is the code:
private void CreateTextBox(int j) //Creates the fields / cells
{
TextBox t = new TextBox();
t.ID = "Textbox" + j;
//t.Text = "Textbox" + j;
lstTextBox.Add(t);
var c = new TableCell();
c.Controls.Add(t);
r.Cells.Add(c);
table1.Rows.Add(r);
Session["test"] = lstTextBox;
}
protected void Button2_Click(object sender, EventArgs e)
{
string[] holder = new string[4];
for (int i = 0; i < holder.Length; i++)
{
holder[i] = "";
}
List<TextBox> lstTextBox = (Session["test"] as List<TextBox>);
if (lstTextBox.Count < Counter)
{
int i = lstTextBox.Count;
for (int j = 0; j < i; j++)
{
holder[j] = lstTextBox[j].Text;
}
SqlConnection conns = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnectionString1"].ConnectionString);
SqlCommand cmd = new SqlCommand("Insert into LoanerForm (field0, field1, field2, field3) Values (#field0, #field1, #field2, #field3)", conns);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("#field0", holder[0]);
cmd.Parameters.AddWithValue("#field1", holder[1]);
cmd.Parameters.AddWithValue("#field2", holder[2]);
cmd.Parameters.AddWithValue("#field3", holder[3]);
conns.Open();
cmd.ExecuteNonQuery();
conns.Close();
}
Counter = 0;
Button1.Visible = true; //Going to submit data to SQL
}
Thank you in advance!
Here is how you create TextBoxes dynamically. It keeps track of the number of textboxes in ViewState.
<asp:Button runat="server" ID="Button1" OnClick="Button1_Click"
Text="Create TextBoxes" />
<asp:Button runat="server" ID="Button2" OnClick="Button2_Click"
Text="Save TextBoxes to Database" />
<asp:PlaceHolder runat="server" ID="PlaceHolder1"></asp:PlaceHolder>
public int Counter
{
get { return Convert.ToInt32(ViewState["Counter"] ?? "0"); }
set { ViewState["Counter"] = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
// Need to reload those textboxes on page back
// Otherwise, they will becomes null
int total = Counter;
for (int i = 0; i < total; i++)
{
var textBox = new TextBox
{
ID = "TextBox" + i,
Text = "TextBox" + i
};
PlaceHolder1.Controls.Add(textBox);
}
}
private void CreateTextBox(int id)
{
var textBox = new TextBox
{
ID = "TextBox" + id,
Text = "TextBox" + id
};
PlaceHolder1.Controls.Add(textBox);
}
protected void Button1_Click(object sender, EventArgs e)
{
CreateTextBox(Counter);
Counter = Counter + 1;
}
protected void Button2_Click(object sender, EventArgs e)
{
int total = Counter;
for (int i = 0; i < total; i++)
{
var textbox = PlaceHolder1.FindControl("TextBox" + i) as TextBox;
var text = textbox.Text;
// Do something with text
}
}
Don't store the TextBoxes in Session; rather, create them on the page.
The trick is creating them at the right time EVERY time (i.e. with each PostBack). Try loading them OnLoad() for the page (or CreateChildControls() if possible).
Once you do that, ASP.NET will automatically associate the input with the TextBox and you should be able to reference them as you normally would or via .FindControl() of the parent.
I think You used big program for generating dynamic textboxes and inserting into data base.For retriving text from dynamically generated textboxes,use the code below..
Request.Form["Textbox" + i.ToString()]
where "i" represents the number of textboxes you generated.
For more info.Please Check the below link.
how to insert value to sql db from dynamically generated textboxes asp.net

Dynamic textfields does not retain data on postback

I created a webform that allows the user to dynamically add more textboxes. Right now, as the button is clicked to add another field, it postbacks to itself. The controls are added in the Pre_Init. However when the page reconstructs itself the textbox names are different each time so the data is not being retained on each postback.
protected void Page_PreInit(object sender, EventArgs e)
{
MasterPage master = this.Master; //had to do this so that controls could be added.
createNewTextField("initEnumValue",true);
RecreateControls("enumValue", "newRow");
}
private int FindOccurence(string substr)
{
string reqstr = Request.Form.ToString();
return ((reqstr.Length - reqstr.Replace(substr, "").Length) / substr.Length);
}
private void RecreateControls(string ctrlPrefix, string ctrlType)
{
string[] ctrls = Request.Form.ToString().Split('&');
int cnt = FindOccurence(ctrlPrefix);
//Response.Write(cnt.ToString() + "<br>");
if (cnt > 0)
{
for (int k = 1; k <= cnt; k++)
{
for (int i = 0; i < ctrls.Length; i++)
{
if (ctrls[i].Contains(ctrlPrefix + k.ToString()) && !ctrls[i].Contains("EVENTTARGET"))
{
string ctrlID = ctrls[i].Split('=')[0];
if (ctrlType == "newRow")
{
createNewTextField(ctrlID,false);
}
break;
}
}
}
}
}
protected void addEnum_Click(object sender, ImageClickEventArgs e)
{
int cnt = FindOccurence("enumValue");
createNewTextField("enumValue" + Convert.ToString(cnt + 1),false);
// Response.Write(cnt.ToString() + "<br>");
}
private void createNewTextField(string ID, bool button)
{
Response.Write(ID + "<br/>"); //this is where I'm getting different names each time there is a postback
if (ID != "initEnumValue") //create new line starting with the second tb.
{
LiteralControl newLine = new LiteralControl();
newLine.Text = "<br />";
this.plhEnum.Controls.Add(newLine);
}
TextBox newTb = new TextBox();
newTb.ID = ID;
this.plhEnum.Controls.Add(newTb);
if (button) //create the button only on the first one.
{
LiteralControl space = new LiteralControl();
space.Text = " ";
this.plhEnum.Controls.Add(space);
ImageButton imgbutton = new ImageButton();
imgbutton.ID = "addEnum";
imgbutton.ImageUrl = "~/images/add.png";
imgbutton.Click += new ImageClickEventHandler(addEnum_Click);
imgbutton.CausesValidation = false;
this.plhEnum.Controls.Add(imgbutton);
}
//endEnumRow();
//this.plhEnum.Controls.Add(newTb);
}
I have tried this solution How can I get data from dynamic generated controls in ASP .NET MVC?

Categories

Resources