473,840 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4211
http://samples.gotdotnet.com/quickst...ormsintro.aspx

"jrett" <jr***@discussi ons.microsoft.c omwrote in message news:42******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message
news:42******** *************** ***********@mic rosoft.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="QuestionTab le" />

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.R ows[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***@discussi ons.microsoft.c omwrote in message
news:42******** *************** ***********@mic rosoft.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(objec t sender, EventArgs e)
{
if (this.IsPostBac k)
{
// if we don't re-render the table and it's text boxes, the
viewstate for these controls is lost.
TableRow[] tableRows =
WebMadLibEngine .GetMadLibTable Data((string)th is.ViewState["FilePathNa me"]);
this.QuestionTa ble.Rows.AddRan ge(tableRows);

//Server.Transfer ("MadLibDisplay Page.aspx");

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

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

((TextBox)this. QuestionTable.R ows[2].Cells[1].Controls[0]).Text
= "Setting this also the hard way.";
}
else if (this.PreviousP age != null)
{
this.MadLibTitl e.Text =
Path.GetFileNam eWithoutExtensi on(PreviousPage .SelectedMadLib FilePathName);
this.ViewState. Add("FilePathNa me",
PreviousPage.Se lectedMadLibFil ePathName);

TableRow[] tableRows =
WebMadLibEngine .GetMadLibTable Data(PreviousPa ge.SelectedMadL ibFilePathName) ;

this.QuestionTa ble.Rows.AddRan ge(tableRows);

((TextBox)this. QuestionTable.R ows[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 ("MadLibSelecti onPage.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="QuestionTab le" />

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.R ows[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***@discussi ons.microsoft.c omwrote in message
news:42******** *************** ***********@mic rosoft.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
2856
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 Python tutorial and docs leave a touch murky to my understanding. Dictionaries/"dict" types... Am I understanding/interpreting correctly when I go with the idea that a "dict" variable can be looked at as (effectively) two parallel arrays?...
7
1267
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 parts? I hope someone can answer my question, thanks! Sharon html+='<TABLE STYLE="border:1pt solid #808080" BGCOLOR="#CCCCCC" WIDTH="140" HEIGHT="220" CELLPADDING="0" CELLSPACING="1">'; html+='<ST'+'YLE TYPE="text/css">\n'; html+='a:link...
3
5679
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 GridView to allow entry of quantity and Y/N switch for
5
2050
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 sequences when I step through the program: 1. Page loaded to the browser 2. Page_Load method is called with non-postback event 3. The user has certain actions on a control 4. Page_Load method is called with postback event
6
1149
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 page_load event which should be executed only when the button is clicked and not on the selectedindexChanged event of the DDL. Also the same function should be executed on Not Page.ispostback.
4
3428
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 RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
1
17055
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 control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
2
2182
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. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
2
3932
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 well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
0
10916
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10598
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10657
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10299
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.