Problem with Placeholder control [modified]
-
Sorry, dident see the dgi. That is acculy not a problem, for in each datagriditem every label would have the id="lb2". as in:
DataGrid dg = new DataGrid();
dg.ID = "dgTheDataGrid";
dg.RunatServer = true;
DataGridItem dgi = new DataGridItem();
Lable lb2 = new Label();
lb2.ID = "lb2";
dgi.AddControl(lb2);
dg.AddControl(dgi);
PlaceHolder2.AddControl(dg);The syntax in this code is probably wrong, but something like this.
Thanks for the reply again. Im finding an error with the line DataGridItem dgi = new DataGridItem(); It says that: No overload for method 'DataGridItem' takes '0' arguments
Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"
-
J4amieC wrote:
You seem to be having memory problems,
Your're the only problem around here
J4amieC wrote:
If that isn't screaming "beginning programming book" then its beyond me what is.
Yes but your reply(which you deleted to cover your back) just suggested to go get a beginners asp.net book rather than actually suggesting a proper tutorial. You seem to be downvoting my posts as well which makes you a hyporcrite and confirms my suspicions that you are a complete moron.
Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"
-
.netman wrote:
Yes but your reply(which you deleted to cover your back)
Wrong again chump, go check again its still there. Idiot.
Deleted Message You really are dumb
Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"
-
Sorry, dident see the dgi. That is acculy not a problem, for in each datagriditem every label would have the id="lb2". as in:
DataGrid dg = new DataGrid();
dg.ID = "dgTheDataGrid";
dg.RunatServer = true;
DataGridItem dgi = new DataGridItem();
Lable lb2 = new Label();
lb2.ID = "lb2";
dgi.AddControl(lb2);
dg.AddControl(dgi);
PlaceHolder2.AddControl(dg);The syntax in this code is probably wrong, but something like this.
Someone provided me with help on another forum so I have some code which works now: Thanks for all the help though! :)
foreach (Control c in PlaceHolder2.Controls)
{
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{
int textboxId = PlaceHolder2.Controls.IndexOf(c);
if (textboxId > 0)
{
Control cLabel = PlaceHolder2.Controls[textboxId - 1];try { Label lb2 = (Label)cLabel; TextBox tb2 = (TextBox)c; SqlCommand cmdinsert = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con); cmdinsert.ExecuteNonQuery(); cmdinsertliftunion.ExecuteNonQuery(); } catch (Exception) { } } }
Deliver yesterday, code today, think tomorrow. "http://www.heuse.com/cphumor.htm"