468,278 Members | 1,576 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

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:Header id="rh" CurrentPage="1" RecordsPerPage="2" runat="server" />
To do:
<Result:Header id="rh" CurrentPage="GetText()" 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 1207
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:Header id="rh" CurrentPage="1" RecordsPerPage="2" runat="server" />
To do:
<Result:Header id="rh" CurrentPage="GetText()" 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:Header 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:Header id="rh" CurrentPage="1" RecordsPerPage="2" runat="server" />
To do:
<Result:Header id="rh" CurrentPage="GetText()" 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**@discussions.microsoft.com> wrote:
Gregory,

It still dosen't work:
<Result:Header id="rh" CurrentPage=<%#GetText()%> RecordsPerPage="2"
runat="server" />
....
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**@discussions.microsoft.com> wrote:
Gregory,

It still dosen't work:
<Result:Header id="rh" CurrentPage=<%#GetText()%> RecordsPerPage="2"
runat="server" />
....
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mike Levin | last post: by
2 posts views Thread by Arun | last post: by
1 post views Thread by DichkoSoft | last post: by
reply views Thread by Christian H | last post: by
2 posts views Thread by Oren | last post: by
2 posts views Thread by Oren | last post: by
reply views Thread by Giovanni | last post: by
reply views Thread by Klaus Jensen | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.