Click here to Skip to main content
15,923,678 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Problem with Placeholder control Pin
thomasa8-Oct-08 0:01
thomasa8-Oct-08 0:01 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 0:15
eyeseetee8-Oct-08 0:15 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 1:16
thomasa8-Oct-08 1:16 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 0:21
eyeseetee8-Oct-08 0:21 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 1:18
thomasa8-Oct-08 1:18 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 1:23
eyeseetee8-Oct-08 1:23 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 1:28
eyeseetee8-Oct-08 1:28 
GeneralRe: Problem with Placeholder control [modified] Pin
thomasa8-Oct-08 1:58
thomasa8-Oct-08 1:58 
if you know the ID of the label and the textbox, the best solution will probably be this:
Lable lb2 = (Lable)PlaceHolder2.FindControl("lb2");
TextBox tb2 = (TextBox)PlaceHolder2.FindControl("tb2");
if(lb2 != null && tb2 != null)
{
SqlCommand cmdinsertliftunion = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con);
cmdinsert.ExecuteNonQuery();     
}              


If you have multiple lables and textboxes in the placeholder and you don't know how many pairs of them you have.
Then you probably need to make all of this in another way. I would recommand that you add a DataGrid to the placeholder and in the
DataGrid you add pairs of lable and textbox. Then the code would look something like this.
DataGrid dg = (DataGrid)PlaceHolder2.FindControl("dgTheDataGrid");
foreace(DataGridItem dgi in dg.Items)
{
Lable lb2 = (Lable)dgi.FindControl("lb2");
TextBox tb2 = (TextBox)dgi.FindControl("tb2");
if(lb2 != null && tb2 != null)
{
SqlCommand cmdinsertliftunion = new SqlCommand("INSERT INTO table(field1, field2) VALUES ('" + lb2.Text + "', '" + tb2.Text + "')", con);
cmdinsert.ExecuteNonQuery();     
}    
}


modified on Wednesday, October 8, 2008 9:20 AM

GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:26
eyeseetee8-Oct-08 2:26 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:31
eyeseetee8-Oct-08 2:31 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 3:16
thomasa8-Oct-08 3:16 
GeneralRe: Problem with Placeholder control Pin
thomasa8-Oct-08 3:40
thomasa8-Oct-08 3:40 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 4:12
eyeseetee8-Oct-08 4:12 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 21:47
eyeseetee8-Oct-08 21:47 
GeneralRe: Problem with Placeholder control Pin
J4amieC8-Oct-08 1:44
J4amieC8-Oct-08 1:44 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:22
eyeseetee8-Oct-08 2:22 
GeneralRe: Problem with Placeholder control Pin
J4amieC8-Oct-08 2:37
J4amieC8-Oct-08 2:37 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 2:46
eyeseetee8-Oct-08 2:46 
GeneralRe: Problem with Placeholder control Pin
J4amieC8-Oct-08 3:29
J4amieC8-Oct-08 3:29 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 4:01
eyeseetee8-Oct-08 4:01 
GeneralRe: Problem with Placeholder control Pin
J4amieC8-Oct-08 4:25
J4amieC8-Oct-08 4:25 
GeneralRe: Problem with Placeholder control Pin
eyeseetee8-Oct-08 4:40
eyeseetee8-Oct-08 4:40 
AnswerRe: Problem with Placeholder control [modified] Pin
J4amieC8-Oct-08 1:47
J4amieC8-Oct-08 1:47 
Questioncreation of Employee Id Card Pin
varsh127-Oct-08 20:38
varsh127-Oct-08 20:38 
AnswerRe: creation of Employee Id Card Pin
Brij7-Oct-08 20:47
mentorBrij7-Oct-08 20:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.