C'tor of WebUserControl

Discussion in 'ASP .Net' started by =?Utf-8?B?T3Jlbg==?=, Oct 17, 2005.

  1. 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
     
    =?Utf-8?B?T3Jlbg==?=, Oct 17, 2005
    #1
    1. Advertising

  2. 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
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Oct 17, 2005
    #2
    1. Advertising

  3. 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
     
    =?Utf-8?B?T3Jlbg==?=, Oct 17, 2005
    #3
  4. =?Utf-8?B?T3Jlbg==?=

    Scott Allen Guest

    On Mon, 17 Oct 2005 11:33:02 -0700, "Oren"
    <> 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-us/vbcon/html/vbcondata-bindingexpressions.asp

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/
     
    Scott Allen, Oct 18, 2005
    #4
  5. 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"
    > <> 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-us/vbcon/html/vbcondata-bindingexpressions.asp
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
     
    =?Utf-8?B?T3Jlbg==?=, Oct 19, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?T3Jlbg==?=

    C'tor of WebUserControl

    =?Utf-8?B?T3Jlbg==?=, Oct 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    471
    =?Utf-8?B?T3Jlbg==?=
    Oct 17, 2005
  2. Raffael Vogler
    Replies:
    8
    Views:
    1,163
    Chris Uppal
    Nov 30, 2003
  3. Mark McFarlane
    Replies:
    9
    Views:
    70,203
    javamazon
    Dec 20, 2011
  4. Jakob Bieling

    Q: c'tor and assignment operators

    Jakob Bieling, Jan 16, 2005, in forum: C++
    Replies:
    1
    Views:
    385
    Rolf Magnus
    Jan 16, 2005
  5. Gernot Frisch

    explicit specialization od c'tor

    Gernot Frisch, Jan 17, 2005, in forum: C++
    Replies:
    11
    Views:
    580
    Andrey Tarasevich
    Jan 17, 2005
Loading...

Share This Page