473,395 Members | 1,393 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,395 software developers and data experts.

C#.NET postback retrieving data question

I'm trying to use

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
txtREID.Text = DataBinder.Eval(Container.DataItem,
"[ID]");

}

}
because I'm using the txtREID.Text within an Insert SQL statement.
But if I try to reference the txtREID within:

<asp:Repeater ID="RepeaterControl" runat="server"
DataSourceID="SqlDataSource3">
<ItemTemplate>
<asp:TextBox ID="txtREID" runat="server" Visible="true"
Text=<%# DataBinder.Eval(Container.DataItem, "[ID]") %>/>
</ItemTemplate>
</asp:Repeater >

I error out stating that the txtREID doesn't exist.

Aug 10 '07 #1
1 1651
First off, this is really more of an ASP.NET question than a C# language one
and probably would have been better placed in the ASP.NET newsgroup.
txtREID is in an ItemTemplate in your Repeater, and so the INamingContainer
hierachy mangles the names to make them unique. An easy way to see this in
action is to simply View Source on the page in your browser.

So the concept of treating this control, which can appear in the Repeater
more than one time, as if it were a static single control on the page simply
won't work.

What exactly is it that you are trying to accomplish?
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"vn****@hotmail.com" wrote:
I'm trying to use

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
txtREID.Text = DataBinder.Eval(Container.DataItem,
"[ID]");

}

}
because I'm using the txtREID.Text within an Insert SQL statement.
But if I try to reference the txtREID within:

<asp:Repeater ID="RepeaterControl" runat="server"
DataSourceID="SqlDataSource3">
<ItemTemplate>
<asp:TextBox ID="txtREID" runat="server" Visible="true"
Text=<%# DataBinder.Eval(Container.DataItem, "[ID]") %>/>
</ItemTemplate>
</asp:Repeater >

I error out stating that the txtREID doesn't exist.

Aug 10 '07 #2

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

Similar topics

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...
10
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
2
by: Alan Lambert | last post by:
If have an asp.net page (code behind written in VB.NET) which needs to store information from a postback in an arraylist and retain this list across multiple postbacks. The variable is declared...
5
by: newmem | last post by:
Hi In the webform, if a use selects a file to upload and submits the form. But if page validation fails, the HtmlInputFile loses the filename string and the user has to re-select the file using...
0
by: fernandezr | last post by:
Hi, I've got a user control that is referenced twice on the same page and I'd like to access the textbox values on postback so I can update a database. How can get the values for each instance of...
0
by: Rick Wez | last post by:
I feel like I'm going to pull out my hair (there's not much left); I've read almost every online post trying to figure this out. So I started over with something VERY simple and it still doesn't...
2
by: echan8 | last post by:
I have a dropdown list in a datagrid which I am dynamically adding items to with JavaScript. When I try to access the value of the dropdown list on postback, there is no value. The value is...
0
by: JP2006 | last post by:
I'm having a major pain with retrieving ViewState info after a postback event. I am trying to persist a string contained in a label (label_AntiBot.Text) that is generated randomly on page load but...
2
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and...
4
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.