473,785 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C'tor of WebUserControl

hi,

How can I call to a Function/Property and send data dynamically to the
UserControl ? I mean Instead (look at CurrentPage):
<Result:Heade r id="rh" CurrentPage="1" RecordsPerPage= "2" runat="server" />
To do:
<Result:Heade r id="rh" CurrentPage="Ge tText()" RecordsPerPage= "2"
runat="server" />

GetText() -> on the Webform...

(code was taken from your link below...)
http://openmymind.net/index.aspx?documentId=9

thanx,
Oren
Nov 19 '05 #1
4 1399
If you need two way communication, work in CodeBehind. If you simply need to
pull a value to the control, you can use the <%# %> tags to get at your Page
CodeBehind and have that get at control properties.

I believe the manner in which you are attempting is out of order, as the
tags are rendered after pre-render. I may be incorrect on that. If so, you
are asking for the constructor to pull information it will not have until
your property is populated.

Either way, it is easier to stick to CodeBehind if you want to start
customizing the way your app renders controls.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"Oren" wrote:
hi,

How can I call to a Function/Property and send data dynamically to the
UserControl ? I mean Instead (look at CurrentPage):
<Result:Heade r id="rh" CurrentPage="1" RecordsPerPage= "2" runat="server" />
To do:
<Result:Heade r id="rh" CurrentPage="Ge tText()" RecordsPerPage= "2"
runat="server" />

GetText() -> on the Webform...

(code was taken from your link below...)
http://openmymind.net/index.aspx?documentId=9

thanx,
Oren

Nov 19 '05 #2
Gregory,

It still dosen't work:
<Result:Heade r id="rh" CurrentPage=<%# GetText()%> RecordsPerPage= "2"
runat="server" />
.....
GetText()-> function/property on Webform

Oren

"Cowboy (Gregory A. Beamer) - MVP" wrote:
If you need two way communication, work in CodeBehind. If you simply need to
pull a value to the control, you can use the <%# %> tags to get at your Page
CodeBehind and have that get at control properties.

I believe the manner in which you are attempting is out of order, as the
tags are rendered after pre-render. I may be incorrect on that. If so, you
are asking for the constructor to pull information it will not have until
your property is populated.

Either way, it is easier to stick to CodeBehind if you want to start
customizing the way your app renders controls.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"Oren" wrote:
hi,

How can I call to a Function/Property and send data dynamically to the
UserControl ? I mean Instead (look at CurrentPage):
<Result:Heade r id="rh" CurrentPage="1" RecordsPerPage= "2" runat="server" />
To do:
<Result:Heade r id="rh" CurrentPage="Ge tText()" RecordsPerPage= "2"
runat="server" />

GetText() -> on the Webform...

(code was taken from your link below...)
http://openmymind.net/index.aspx?documentId=9

thanx,
Oren

Nov 19 '05 #3
On Mon, 17 Oct 2005 11:33:02 -0700, "Oren"
<Or**@discussio ns.microsoft.co m> wrote:
Gregory,

It still dosen't work:
<Result:Head er id="rh" CurrentPage=<%# GetText()%> RecordsPerPage= "2"
runat="serve r" />
....
GetText()-> function/property on Webform


Oren: What is happening? Are you getting a runtime error or just no
value? With data binding expressions like <%# %> you need to explicity
call DataBind on the control or on the page to have the expression
evaluated.

http://msdn.microsoft.com/library/en...xpressions.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4
Hi Gregory,

Please let me explain again:

I have WebUserControl on a Webform.
How can I sent dynamically to the WebUserControl from a Function/Property on
the Webform ? (data="2" is a static way)
<uc:myuc id="myid1" CurrentPage=<%# GetText()%> data="2" runat="server"/>
.....
GetText()-> function/property on the Webform, returns string and send it to
the WebUserControl -> <%#GetText()% >

It's not working. no data is being send. any idea why ?

thanx,
Oren

"Scott Allen" wrote:
On Mon, 17 Oct 2005 11:33:02 -0700, "Oren"
<Or**@discussio ns.microsoft.co m> wrote:
Gregory,

It still dosen't work:
<Result:Head er id="rh" CurrentPage=<%# GetText()%> RecordsPerPage= "2"
runat="serve r" />
....
GetText()-> function/property on Webform


Oren: What is happening? Are you getting a runtime error or just no
value? With data binding expressions like <%# %> you need to explicity
call DataBind on the control or on the page to have the expression
evaluated.

http://msdn.microsoft.com/library/en...xpressions.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #5

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

Similar topics

0
1630
by: Christian | last post by:
Hi, I try to change the position of a WebUserControl on my WEbform (layout is set to GridLayout) by changing the absolute position in the html-code but it does not work. When I change the position at design-time for my user control by changing it directly in html-code is the change reflected in the design view (and vice-versa). But when I run the app is the control always positioned at the same location (somewhere topleft on the page)
0
1001
by: Mike Levin | last post by:
Hello Group, I'm using VisualStudio.NET and put a DataGrid into a WebUserControl (an ascx file). For the DataGrid element, I have set AllowSorting="True" and OnSortCommand="Grid_Sort".
2
2109
by: Arun | last post by:
I am new to ASP.NET I need some help for this scenario The scenario is like this I have a template Page which loads a WebUserControl (uct1.ascx) inside a PlaceHolder (PH1) Now this Web User Control (uct1.ascx) has a table with 2 rows First row has a 5 text boxes 2 Combobox and 6 buttons (all Server Controls)
1
1978
by: DichkoSoft | last post by:
Hi I create WebUserControl and very confused when use control For Example: ***************************** *wuc.ascx ***************************** <script id=clientEventHandlersJS language=javascript>
0
1119
by: Christian H | last post by:
Hello, I've just created a WebUserControl that consists of a few other controls such as DropDownList, TextBox and Button. Based on the information entered in the DropDownlist, and TextBox, the Button.onClick event quries a database, and returns a DataTable. Because I'm going to use this control different places, and bind the DataTable in different ways (sometimes a datagrid, sometimes repeater) , I added a delegate...
2
275
by: Oren | last post by:
Hello everyone... I have a simple WebUserControl with Button and TextBox on it. Webform1.aspx contains this WebUserControl. How can I create my own C'tor for this WebUserControl - I mean when I run Webform1.aspx I want to send data to the UserControl (fill Textbox1.Text). any samples ? thanx,
2
315
by: Oren | last post by:
Hi everyone, I have WebUserControl on a Webform. How can I sent dynamically to the WebUserControl from a Function/Property on the Webform ? <uc:myuc id="myid1" CurrentPage=<%#GetText()%> data="2" runat="server"/> ..... GetText()-> function/property on the Webform, returns string and send it to the WebUserControl -> <%#GetText()%>
0
1182
by: Giovanni | last post by:
Dear Friends, I have a decision to make and hope to get some insight: I have built several WebUserControls one of which is a WebUserControl that queries an SQL server database, retrieves a filename and loads an image control. The WebUserControl itself contains an SQLDataSource and an image box. I also have other WebUserControls that implement the same concept as previously mentioned. The SQLDataSource is bound to a session variable...
0
1102
by: Klaus Jensen | last post by:
Hi In a repeater-control, in the <SeparatorTemplatei have placed a webusercontrol, I have made. That works great- However, I want to know be able to only display this WebUserControl a certain number of times. Basicly I need the WebUserControl itself to know, how many other instances of the webusercontrol was displayed on the page, when I run it.
1
1185
by: deeparengan | last post by:
hi in asp.net i have a webusercontrol that has three dropdownlist.In the first dropdownlist i loaded the data at design time and in second dropdownlist i load the some data at run time according to the selected value in first drop downlist and in the third i loaded the values none,and,or. I want coding to display same webusercontrol while i click the values and,or in third dropdownlist placed in webusercontrol.
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
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
10162
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
10100
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
9959
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
8988
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
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.