473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ASP.NET rookie needs help finding postback data

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
Sep 20 '06 #1
4 4189
http://samples.gotdotnet.com/quickst...ormsintro.aspx

"jrett" <jr***@discussions.microsoft.comwrote in message news:42**********************************@microsof t.com...
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

Sep 20 '06 #2
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" <jr***@discussions.microsoft.comwrote in message
news:42**********************************@microsof t.com...
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

Sep 20 '06 #3
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" <jr***@discussions.microsoft.comwrote in message
news:42**********************************@microsof t.com...
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


Sep 21 '06 #4
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" <jr***@discussions.microsoft.comwrote in message
news:42**********************************@microsof t.com...
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
Sep 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Don Bruder | last post by:
A week or two ago, I asked here about porting Python to C. Got some good answers (Note 1) but now I've got another question. Actually, more a request for clarification of a topic that both the...
7
by: Sharon | last post by:
Hiya I have a small question, I saw this piece of code somewhere (it's for creating a customized context menu) and I was wondering: Why is it that the STYLE and SCRIPT-tags are broken up into...
3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
5
by: Matthew Louden | last post by:
I created simple ASP.NET web application to test how AutoPostBack property in a web control works. I set AutoPostBack property to be true of a web control. When I run the application, here's the...
6
by: Jithu | last post by:
hi, I have a dropdownlist and a button in my web page. Both controls fire the page_load event on postback. I want to find out which control does the postback? I have a function in the...
4
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.