473,465 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Codebehind and object declaration

I'm a little confused why on codebehind file in asp.net 2.0 I cannot
directly access to the object places on the designer.
I can reach them via FindControl method, but I would like to find some
simply sheed that shows me the correct rules about this aspect of
asp.net programming.

technically I could modify designer.cs file, but it doesn't sound like
a good way. It could happen like in asp.net 1.0 or even 1..1 that a
manual changes affect the final behaviour or the page, or worse,
designer when restart delete changes done manually.

Thanks for your patience.

Andrea

Sep 10 '07 #1
4 1258
Not sure what you meant.

It depends where you put the control. If not inside a naming container
you'll have access to it. If inside a container you won't as for example
you'll have multiple instances, once for each bounded row.

I'm not sure though what you meant by "directly access to the object places
on the designer" ? As you talk also about FindControl my understanding is
that you meant "using the variable that represents the control" ?

--
Patrice

"Andrew2" <an***************@gmail.coma écrit dans le message de news:
11**********************@w3g2000hsg.googlegroups.c om...
I'm a little confused why on codebehind file in asp.net 2.0 I cannot
directly access to the object places on the designer.
I can reach them via FindControl method, but I would like to find some
simply sheed that shows me the correct rules about this aspect of
asp.net programming.

technically I could modify designer.cs file, but it doesn't sound like
a good way. It could happen like in asp.net 1.0 or even 1..1 that a
manual changes affect the final behaviour or the page, or worse,
designer when restart delete changes done manually.

Thanks for your patience.

Andrea

Sep 10 '07 #2
On Sep 10, 4:22 pm, "Patrice" <http://www.chez.com/scribe/wrote:
Not sure what you meant.
my understanding is that you meant "using the variable that represents the control" ?
Exactly what I want to say. Imagine the code below.

<asp:FormView ID="FormView1" runat="server"
DataSourceID="ProductDataSource"
OnDataBound="FormView1_DataBound">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" />
<asp:Label ID="Notes" runat="server" />
<asp:Panel ID="colorsPanel"
runat="server">
<asp:Repeater ID="ColorList" runat="server">
Well, in the codefiel I would like to simple do ColorList. .... and
get method and properties. But a FormView should be a naming container
and so I suppose that is impossible.

Why is not really clear ... where can I find more info about this
aspect? A specific link on MSDN or something around the net.

Thanks
Andrea

Sep 10 '07 #3
Ok, with the right keywords is more easy to find docs. While searching
in italian I wasn't able to get the same results.

http://msdn2.microsoft.com/en-us/lib...ss(VS.71).aspx
and
http://msdn2.microsoft.com/en-us/lib...d6(VS.71).aspx

and
http://weblogs.asp.net/dwahlin/archi...ard-about.aspx

at point 4 for a nice tip.

Thanks
Andrea

Sep 10 '07 #4
I would recommend against this tip or at least you may want to know that
this delimited can change depending what is the (X)HTML standard you are
looking for.

When you search for a control in the appropirate event, you don't have AFAIK
in most cases to take into account the hierarchy as you are already well
placed...


"Andrew2" <an***************@gmail.coma écrit dans le message de news:
11**********************@19g2000hsx.googlegroups.c om...
Ok, with the right keywords is more easy to find docs. While searching
in italian I wasn't able to get the same results.

http://msdn2.microsoft.com/en-us/lib...ss(VS.71).aspx
and
http://msdn2.microsoft.com/en-us/lib...d6(VS.71).aspx

and
http://weblogs.asp.net/dwahlin/archi...ard-about.aspx

at point 4 for a nice tip.

Thanks
Andrea

Sep 11 '07 #5

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

Similar topics

4
by: Boban Dragojlovic | last post by:
I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX) Later, I switch to codeview, and I notice that some (sometimes all) of the...
6
by: Nehal Shah | last post by:
I've read that in the Page Directive of an aspx page, changing the CodeBehind attribute to Src saves you from having to compile the page before refreshing. This is preferable in a large...
12
by: A.M | last post by:
Hi, Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i still have intelisence and generally IDE support for that? Thanks, Ali
1
by: Michael | last post by:
Hello, I'm trying to implement sample I found on page templates, so I do not have to maintain "<html><head>..." on all my documents. But don't let that confuse you, this is an inheritance...
3
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to...
7
by: dw | last post by:
Hello, all. I created a few Label objects, and deleted some. However, later when I was using the codebehind page in VS .NET 2003 to set the Text of the existing labels, I noticed that when I hit...
4
by: Kurt Schroeder | last post by:
I have a simple aspx page called type with a datagrid/w id=dGrdTyp My code behind page is not reconizing the control on the aspx page. Visualstudio.Net flaggs the dgrdTyp as undefined. Any Help?...
7
by: Jack | last post by:
Hello, What is the difference between SRC and CODEBEHIND Tags? Example <%@ Page Language="vb" ValidateRequest="false" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" %> or
6
by: antonyliu2002 | last post by:
Right now I put my VB code in the aspx pages. I would prefer to use codebehind, especially many of my VB functions may be shared across multiple aspx pages. I've tried a few pages with...
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
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...
1
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.