currently i working for a button click event where i want to adding text into textarea content
For example
textbox A = "name"
dropdownlist = "string"
after click button, it will be come
output
public class abc {
private string name;
}
when i click on the button for second time with textbox A = "job"
then it will become
output
public class abc {
private string name;
private string job;
}
i only can make it by displaying the same text for several times, where the output is like
output
public class abc {
private string name;
private string name;
private string name;
}
currently this is my code behind
String temp = "";
String classtemp = txtclassname.Text;
String vartemp = txtvariable.Text;
String datatemp = ddldatatype.SelectedValue;
protected void btaddvar_Click(object sender, EventArgs e)
{
int rowCount = 0;
rowCount = Convert.ToInt32(Session["clicks"]);
rowCount++;
Session["clicks"] = rowCount;
for (int i = 0; i < rowCount; i++)
{
temp += "private " + datatemp + " " + vartemp + ";\n";
}
txtclasscode2.Text = "public class " + classtemp + " {\n\n" + temp.ToString() + "\n}";
}
i know that the mistakes i have done in my for loop statement, but i can't figure it out
how to play around with it since my knowledge about c# asp.net still very poor.
Anyone can help me or give some suggestion?