Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET rookie needs help finding postback data

Reply
Thread Tools

ASP.NET rookie needs help finding postback data

 
 
=?Utf-8?B?anJldHQ=?=
Guest
Posts: n/a
 
      09-20-2006
I'm new to ASP.NET and fairly inexperienced with web development in general,
but I've been a professional software dev for over 10 years, C++, Unix and
windows, C# the past 4 years.

I've been working on a personal ASP.NET project, basically as a learning
tool and I have a major issue which is really really getting on my nerves.

I'm creating a web application in ASP.NET 2.0 which dynamically populates a
table with text and text boxes. This table has two columns; in the left colum
are fields labelling the text boxes on the right column.

After post back, I cannot for the life of me find the values that were
entered into the text boxes. When I turn tracing on, I see in the 'Form
Collection' that my values have in fact been kept via ViewState, but when I
go into the Table object, the 'rows' are empty.

I'm sure this is going to be a difficult one to diagnose via this post as it
appears to be pretty vague, bug perhaps if you can explain to me how to find
a control by either the control ID or by the Unique ID? The Unique ID is
shown in the trace output. I've tried using a debugger and examined the
Table object in a watch window, but there are a million nodes on that.

Please help!! This has been keeping me up at night. It seems like such a
simple friggin thing.

--
Jaan
 
Reply With Quote
 
 
 
 
Jon Paal
Guest
Posts: n/a
 
      09-20-2006
http://samples.gotdotnet.com/quickst...ormsintro.aspx



"jrett" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> I'm new to ASP.NET and fairly inexperienced with web development in general,
> but I've been a professional software dev for over 10 years, C++, Unix and
> windows, C# the past 4 years.
>
> I've been working on a personal ASP.NET project, basically as a learning
> tool and I have a major issue which is really really getting on my nerves.
>
> I'm creating a web application in ASP.NET 2.0 which dynamically populates a
> table with text and text boxes. This table has two columns; in the left colum
> are fields labelling the text boxes on the right column.
>
> After post back, I cannot for the life of me find the values that were
> entered into the text boxes. When I turn tracing on, I see in the 'Form
> Collection' that my values have in fact been kept via ViewState, but when I
> go into the Table object, the 'rows' are empty.
>
> I'm sure this is going to be a difficult one to diagnose via this post as it
> appears to be pretty vague, bug perhaps if you can explain to me how to find
> a control by either the control ID or by the Unique ID? The Unique ID is
> shown in the trace output. I've tried using a debugger and examined the
> Table object in a watch window, but there are a million nodes on that.
>
> Please help!! This has been keeping me up at night. It seems like such a
> simple friggin thing.
>
> --
> Jaan



 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      09-20-2006
Hi Jann,

What kind of table are you using? A plain HTML table? A datagrid? An ASP.NET
table?

It would help to see the code that isn't working.

Ken
Microsoft MVP [ASP.NET]

"jrett" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm new to ASP.NET and fairly inexperienced with web development in
> general,
> but I've been a professional software dev for over 10 years, C++, Unix and
> windows, C# the past 4 years.
>
> I've been working on a personal ASP.NET project, basically as a learning
> tool and I have a major issue which is really really getting on my nerves.
>
> I'm creating a web application in ASP.NET 2.0 which dynamically populates
> a
> table with text and text boxes. This table has two columns; in the left
> colum
> are fields labelling the text boxes on the right column.
>
> After post back, I cannot for the life of me find the values that were
> entered into the text boxes. When I turn tracing on, I see in the 'Form
> Collection' that my values have in fact been kept via ViewState, but when
> I
> go into the Table object, the 'rows' are empty.
>
> I'm sure this is going to be a difficult one to diagnose via this post as
> it
> appears to be pretty vague, bug perhaps if you can explain to me how to
> find
> a control by either the control ID or by the Unique ID? The Unique ID is
> shown in the trace output. I've tried using a debugger and examined the
> Table object in a watch window, but there are a million nodes on that.
>
> Please help!! This has been keeping me up at night. It seems like such a
> simple friggin thing.
>
> --
> Jaan



 
Reply With Quote
 
=?Utf-8?B?anJldHQ=?=
Guest
Posts: n/a
 
      09-21-2006
I'll post the source code tonight, or email it, as I currently don't have
access to it.

However, I am using a master page, and on that master page I have a content
placeholder, and in the implementation page that uses that master page, I
have in that placeholder:
<asp:Table runat="server" ID="QuestionTable" />

Then in my code behind page I populate that table with rows, each row
consisting of two cells. The first cell just has some text, the next cell has
a textbox.
This is done at runtime because the user can make choices which will
determine how many rows are put into that table.

In the Page_Init/ or Page_load or whatever it was (I don't remember the
function name exactly, but its the one method that VS puts in there for you)
The first time the page loads, I populate the table, and I can access the
first row->second cell with this:
((TextBox)this.QuestionTable.Rows[0].Cells[1].Controls[0]).Text; I can set
the text and I can read it. But when I put the same thing after checking for
IsPostBack, it doesn't have the posted back values!!!
I've looked at all kinds of data in the debugger, I've looked at the trace
output, I just cant find this data!

Thanks for getting back to me so soon.

Jaan

--
Jaan


"Ken Cox [Microsoft MVP]" wrote:

> Hi Jann,
>
> What kind of table are you using? A plain HTML table? A datagrid? An ASP.NET
> table?
>
> It would help to see the code that isn't working.
>
> Ken
> Microsoft MVP [ASP.NET]
>
> "jrett" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I'm new to ASP.NET and fairly inexperienced with web development in
> > general,
> > but I've been a professional software dev for over 10 years, C++, Unix and
> > windows, C# the past 4 years.
> >
> > I've been working on a personal ASP.NET project, basically as a learning
> > tool and I have a major issue which is really really getting on my nerves.
> >
> > I'm creating a web application in ASP.NET 2.0 which dynamically populates
> > a
> > table with text and text boxes. This table has two columns; in the left
> > colum
> > are fields labelling the text boxes on the right column.
> >
> > After post back, I cannot for the life of me find the values that were
> > entered into the text boxes. When I turn tracing on, I see in the 'Form
> > Collection' that my values have in fact been kept via ViewState, but when
> > I
> > go into the Table object, the 'rows' are empty.
> >
> > I'm sure this is going to be a difficult one to diagnose via this post as
> > it
> > appears to be pretty vague, bug perhaps if you can explain to me how to
> > find
> > a control by either the control ID or by the Unique ID? The Unique ID is
> > shown in the trace output. I've tried using a debugger and examined the
> > Table object in a watch window, but there are a million nodes on that.
> >
> > Please help!! This has been keeping me up at night. It seems like such a
> > simple friggin thing.
> >
> > --
> > Jaan

>
>
>

 
Reply With Quote
 
=?Utf-8?B?anJldHQ=?=
Guest
Posts: n/a
 
      09-22-2006
Okay, apparently there is not way to post my sources, so I'll try to copy and
paste the relevant portions.


protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack)
{
// if we don't re-render the table and it's text boxes, the
viewstate for these controls is lost.
TableRow[] tableRows =
WebMadLibEngine.GetMadLibTableData((string)this.Vi ewState["FilePathName"]);
this.QuestionTable.Rows.AddRange(tableRows);

//Server.Transfer("MadLibDisplayPage.aspx");

Response.Write(string.Format("The first text box says: [{0}]",

((TextBox)this.QuestionTable.Rows[0].Cells[1].Controls[0]).Text));

((TextBox)this.QuestionTable.Rows[2].Cells[1].Controls[0]).Text
= "Setting this also the hard way.";
}
else if (this.PreviousPage != null)
{
this.MadLibTitle.Text =
Path.GetFileNameWithoutExtension(PreviousPage.Sele ctedMadLibFilePathName);
this.ViewState.Add("FilePathName",
PreviousPage.SelectedMadLibFilePathName);

TableRow[] tableRows =
WebMadLibEngine.GetMadLibTableData(PreviousPage.Se lectedMadLibFilePathName);

this.QuestionTable.Rows.AddRange(tableRows);

((TextBox)this.QuestionTable.Rows[1].Cells[1].Controls[0]).Text
= "Setting this the hard way.";
}
else
{
// if there is no previous page, then let's load it!!
Server.Transfer("MadLibSelectionPage.aspx");
}
}




--
Jaan


"jrett" wrote:

> I'll post the source code tonight, or email it, as I currently don't have
> access to it.
>
> However, I am using a master page, and on that master page I have a content
> placeholder, and in the implementation page that uses that master page, I
> have in that placeholder:
> <asp:Table runat="server" ID="QuestionTable" />
>
> Then in my code behind page I populate that table with rows, each row
> consisting of two cells. The first cell just has some text, the next cell has
> a textbox.
> This is done at runtime because the user can make choices which will
> determine how many rows are put into that table.
>
> In the Page_Init/ or Page_load or whatever it was (I don't remember the
> function name exactly, but its the one method that VS puts in there for you)
> The first time the page loads, I populate the table, and I can access the
> first row->second cell with this:
> ((TextBox)this.QuestionTable.Rows[0].Cells[1].Controls[0]).Text; I can set
> the text and I can read it. But when I put the same thing after checking for
> IsPostBack, it doesn't have the posted back values!!!
> I've looked at all kinds of data in the debugger, I've looked at the trace
> output, I just cant find this data!
>
> Thanks for getting back to me so soon.
>
> Jaan
>
> --
> Jaan
>
>
> "Ken Cox [Microsoft MVP]" wrote:
>
> > Hi Jann,
> >
> > What kind of table are you using? A plain HTML table? A datagrid? An ASP.NET
> > table?
> >
> > It would help to see the code that isn't working.
> >
> > Ken
> > Microsoft MVP [ASP.NET]
> >
> > "jrett" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I'm new to ASP.NET and fairly inexperienced with web development in
> > > general,
> > > but I've been a professional software dev for over 10 years, C++, Unix and
> > > windows, C# the past 4 years.
> > >
> > > I've been working on a personal ASP.NET project, basically as a learning
> > > tool and I have a major issue which is really really getting on my nerves.
> > >
> > > I'm creating a web application in ASP.NET 2.0 which dynamically populates
> > > a
> > > table with text and text boxes. This table has two columns; in the left
> > > colum
> > > are fields labelling the text boxes on the right column.
> > >
> > > After post back, I cannot for the life of me find the values that were
> > > entered into the text boxes. When I turn tracing on, I see in the 'Form
> > > Collection' that my values have in fact been kept via ViewState, but when
> > > I
> > > go into the Table object, the 'rows' are empty.
> > >
> > > I'm sure this is going to be a difficult one to diagnose via this post as
> > > it
> > > appears to be pretty vague, bug perhaps if you can explain to me how to
> > > find
> > > a control by either the control ID or by the Unique ID? The Unique ID is
> > > shown in the trace output. I've tried using a debugger and examined the
> > > Table object in a watch window, but there are a million nodes on that.
> > >
> > > Please help!! This has been keeping me up at night. It seems like such a
> > > simple friggin thing.
> > >
> > > --
> > > Jaan

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET rookie needs help finding control data jrett ASP General 2 09-20-2006 10:59 AM
javascript rookie needs a close-window button ...D. Javascript 2 09-18-2004 06:04 PM
Rookie question about data types (hashtables) Steve D. Perkins Python 7 01-29-2004 10:17 PM
MCSE rookie need help Marko MCSE 0 09-16-2003 05:43 AM
Re: MCSE rookie need help gg77 MCSE 0 09-15-2003 05:34 PM



Advertisments