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

ASP.NET

 
AnswerRe: Start Up help Pin
Blikkies20-Oct-09 19:39
professionalBlikkies20-Oct-09 19:39 
Questionfind all images id from html file and store in array in c# Pin
vnsraj19-Oct-09 23:47
vnsraj19-Oct-09 23:47 
AnswerRe: find all images id from html file and store in array in c# Pin
Christian Graus19-Oct-09 23:59
protectorChristian Graus19-Oct-09 23:59 
AnswerRe: find all images id from html file and store in array in c# Pin
vnsraj20-Oct-09 0:43
vnsraj20-Oct-09 0:43 
AnswerRe: find all images id from html file and store in array in c# Pin
Shameel20-Oct-09 4:52
professionalShameel20-Oct-09 4:52 
QuestionPaging in DataList Pin
Shalini_U19-Oct-09 23:46
Shalini_U19-Oct-09 23:46 
AnswerRe: Paging in DataList Pin
Christian Graus20-Oct-09 0:00
protectorChristian Graus20-Oct-09 0:00 
GeneralRe: Paging in DataList Pin
Shalini_U20-Oct-09 0:09
Shalini_U20-Oct-09 0:09 
GeneralRe: Paging in DataList Pin
Christian Graus20-Oct-09 0:37
protectorChristian Graus20-Oct-09 0:37 
GeneralRe: Paging in DataList Pin
Shalini_U20-Oct-09 2:24
Shalini_U20-Oct-09 2:24 
QuestionMenu in ASP.NET Pin
Nanda_MR19-Oct-09 23:43
Nanda_MR19-Oct-09 23:43 
AnswerRe: Menu in ASP.NET Pin
Christian Graus20-Oct-09 0:02
protectorChristian Graus20-Oct-09 0:02 
GeneralRe: Menu in ASP.NET Pin
Nanda_MR20-Oct-09 0:18
Nanda_MR20-Oct-09 0:18 
GeneralRe: Menu in ASP.NET Pin
Christian Graus20-Oct-09 0:38
protectorChristian Graus20-Oct-09 0:38 
GeneralRe: Menu in ASP.NET Pin
Nanda_MR20-Oct-09 1:29
Nanda_MR20-Oct-09 1:29 
QuestionHow to show GridView on Page load and populate it with data from textboxes Pin
Nopo19-Oct-09 22:52
Nopo19-Oct-09 22:52 
Hi all,
I'm developing an ASP.Net app with C#. I have a Gridview that I want to show right on page load. I'm then capturing data into the textboxes and need to save it on the gridview right after clicking ADD button.

I can't get my Gridview displayed on page load and when saving the data from the textboxes to the Gridview I get this error:
"Column ‘Full Names’ does not belong to table"

This is what I've got in my code

html Design:
<asp:gridview id="dgInfoProfile1" runat="server" autogeneratecolumns="False">
<columns>
<asp:templatefield headertext="Full Names">
<asp:templatefield headertext="Identifying Number">
<asp:templatefield headertext="Passport Number">



Page_Load:

protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Full Names"));
dt.Columns.Add(new DataColumn("Identifying Number"));
dt.Columns.Add(new DataColumn("Passport Number"));
this.dgInfoProfile.DataSource = dt;
dgInfoProfile.DataBind();

}

ADD button:
protected void brtAdd_Click(object sender, EventArgs e)
{
try
{
DataRow dr = dt.NewRow();
dr["Full Names"] = txtFirstName3.Text;
dr["Identifying Number"] = txtIdentityNo.Text;
dr["Passport Number"] = txtPassportNo.Text;
dt.Rows.Add(dr);

//Bind GridView Here with this Table
this.dgInfoProfile.DataSource = dt;
dgInfoProfile.DataBind();

}
catch (Exception ex)
{
Response.Write(ex.Message);
}

}

I'm not sure where I've missed it, your advice and help in this is highly appreciated.

Thanks.
Confused | :confused:
AnswerRe: How to show GridView on Page load and populate it with data from textboxes Pin
nagendrathecoder19-Oct-09 23:00
nagendrathecoder19-Oct-09 23:00 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
Nopo19-Oct-09 23:27
Nopo19-Oct-09 23:27 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
nagendrathecoder19-Oct-09 23:32
nagendrathecoder19-Oct-09 23:32 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
Nopo20-Oct-09 0:16
Nopo20-Oct-09 0:16 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
nagendrathecoder20-Oct-09 0:18
nagendrathecoder20-Oct-09 0:18 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
Nopo20-Oct-09 3:36
Nopo20-Oct-09 3:36 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
Abhijit Jana20-Oct-09 4:09
professionalAbhijit Jana20-Oct-09 4:09 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
nagendrathecoder20-Oct-09 18:34
nagendrathecoder20-Oct-09 18:34 
GeneralRe: How to show GridView on Page load and populate it with data from textboxes Pin
Leezo8729-Oct-09 3:19
Leezo8729-Oct-09 3:19 

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.