Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > user control and databinding expression

Reply
Thread Tools

user control and databinding expression

 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-25-2006
hey all,
for simplicity's sake i have a single textbox inside a user control. once i
drag that user control onto my page is there a way to attach a binding
expression to it at runtime?

thanks,
rodchar
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-25-2006
User control can expose properties. You can make a property that will set
the binding expression. Is it what you are after?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"rodchar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hey all,
> for simplicity's sake i have a single textbox inside a user control. once
> i
> drag that user control onto my page is there a way to attach a binding
> expression to it at runtime?
>
> thanks,
> rodchar



 
Reply With Quote
 
 
 
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-25-2006
yes, i've exposed public properties in a user control but which one do i
expose in this case. i couldn't find the DataBindings.Add for the textbox in
my user control (with the context of being in the user control designer).

i guess what i'm asking is what public property do i expose on the user
control and how do i set it?

thanks,
rodchar

"Eliyahu Goldin" wrote:

> User control can expose properties. You can make a property that will set
> the binding expression. Is it what you are after?
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "rodchar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > hey all,
> > for simplicity's sake i have a single textbox inside a user control. once
> > i
> > drag that user control onto my page is there a way to attach a binding
> > expression to it at runtime?
> >
> > thanks,
> > rodchar

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-25-2006
Something like this?

public string TextBinding
{
set
{
myText.Text = value;
myText.DataBind();
}
}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"rodchar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> yes, i've exposed public properties in a user control but which one do i
> expose in this case. i couldn't find the DataBindings.Add for the textbox
> in
> my user control (with the context of being in the user control designer).
>
> i guess what i'm asking is what public property do i expose on the user
> control and how do i set it?
>
> thanks,
> rodchar
>
> "Eliyahu Goldin" wrote:
>
>> User control can expose properties. You can make a property that will set
>> the binding expression. Is it what you are after?
>>
>> --
>> Eliyahu Goldin,
>> Software Developer & Consultant
>> Microsoft MVP [ASP.NET]
>>
>>
>> "rodchar" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > hey all,
>> > for simplicity's sake i have a single textbox inside a user control.
>> > once
>> > i
>> > drag that user control onto my page is there a way to attach a binding
>> > expression to it at runtime?
>> >
>> > thanks,
>> > rodchar

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-25-2006
I'm not sure what i'm doing wrong:

<uc1:webusercontrol id="WebUserControl1" runat="server" uctextbox='<%#
"GetTime()" %>'></uc1:webusercontrol>

defined on the .aspx:
Public Function GetTime() As String
Return DateTime.Now.ToString("T")
End Function

defined on the control page:
Public Property UcTextBox() As String
Get
Return Me.TextBox1.Text
End Get
Set(ByVal value As String)
Me.TextBox1.Text = value
End Set
End Property

And the result is that nothing shows up in the textbox.

"Eliyahu Goldin" wrote:

> Something like this?
>
> public string TextBinding
> {
> set
> {
> myText.Text = value;
> myText.DataBind();
> }
> }
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "rodchar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > yes, i've exposed public properties in a user control but which one do i
> > expose in this case. i couldn't find the DataBindings.Add for the textbox
> > in
> > my user control (with the context of being in the user control designer).
> >
> > i guess what i'm asking is what public property do i expose on the user
> > control and how do i set it?
> >
> > thanks,
> > rodchar
> >
> > "Eliyahu Goldin" wrote:
> >
> >> User control can expose properties. You can make a property that will set
> >> the binding expression. Is it what you are after?
> >>
> >> --
> >> Eliyahu Goldin,
> >> Software Developer & Consultant
> >> Microsoft MVP [ASP.NET]
> >>
> >>
> >> "rodchar" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > hey all,
> >> > for simplicity's sake i have a single textbox inside a user control.
> >> > once
> >> > i
> >> > drag that user control onto my page is there a way to attach a binding
> >> > expression to it at runtime?
> >> >
> >> > thanks,
> >> > rodchar
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      10-25-2006
call DataBind()

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"rodchar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm not sure what i'm doing wrong:
>
> <uc1:webusercontrol id="WebUserControl1" runat="server" uctextbox='<%#
> "GetTime()" %>'></uc1:webusercontrol>
>
> defined on the .aspx:
> Public Function GetTime() As String
> Return DateTime.Now.ToString("T")
> End Function
>
> defined on the control page:
> Public Property UcTextBox() As String
> Get
> Return Me.TextBox1.Text
> End Get
> Set(ByVal value As String)
> Me.TextBox1.Text = value
> End Set
> End Property
>
> And the result is that nothing shows up in the textbox.
>
> "Eliyahu Goldin" wrote:
>
>> Something like this?
>>
>> public string TextBinding
>> {
>> set
>> {
>> myText.Text = value;
>> myText.DataBind();
>> }
>> }
>>
>> --
>> Eliyahu Goldin,
>> Software Developer & Consultant
>> Microsoft MVP [ASP.NET]
>>
>>
>> "rodchar" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > yes, i've exposed public properties in a user control but which one do
>> > i
>> > expose in this case. i couldn't find the DataBindings.Add for the
>> > textbox
>> > in
>> > my user control (with the context of being in the user control
>> > designer).
>> >
>> > i guess what i'm asking is what public property do i expose on the user
>> > control and how do i set it?
>> >
>> > thanks,
>> > rodchar
>> >
>> > "Eliyahu Goldin" wrote:
>> >
>> >> User control can expose properties. You can make a property that will
>> >> set
>> >> the binding expression. Is it what you are after?
>> >>
>> >> --
>> >> Eliyahu Goldin,
>> >> Software Developer & Consultant
>> >> Microsoft MVP [ASP.NET]
>> >>
>> >>
>> >> "rodchar" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > hey all,
>> >> > for simplicity's sake i have a single textbox inside a user control.
>> >> > once
>> >> > i
>> >> > drag that user control onto my page is there a way to attach a
>> >> > binding
>> >> > expression to it at runtime?
>> >> >
>> >> > thanks,
>> >> > rodchar
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-25-2006
sorry for just not getting it, but where do i from? (control page in the
properties, on on the .aspx page) i tried in both places and i'm not getting
anything?

"Eliyahu Goldin" wrote:

> call DataBind()
>
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
>
> "rodchar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I'm not sure what i'm doing wrong:
> >
> > <uc1:webusercontrol id="WebUserControl1" runat="server" uctextbox='<%#
> > "GetTime()" %>'></uc1:webusercontrol>
> >
> > defined on the .aspx:
> > Public Function GetTime() As String
> > Return DateTime.Now.ToString("T")
> > End Function
> >
> > defined on the control page:
> > Public Property UcTextBox() As String
> > Get
> > Return Me.TextBox1.Text
> > End Get
> > Set(ByVal value As String)
> > Me.TextBox1.Text = value
> > End Set
> > End Property
> >
> > And the result is that nothing shows up in the textbox.
> >
> > "Eliyahu Goldin" wrote:
> >
> >> Something like this?
> >>
> >> public string TextBinding
> >> {
> >> set
> >> {
> >> myText.Text = value;
> >> myText.DataBind();
> >> }
> >> }
> >>
> >> --
> >> Eliyahu Goldin,
> >> Software Developer & Consultant
> >> Microsoft MVP [ASP.NET]
> >>
> >>
> >> "rodchar" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > yes, i've exposed public properties in a user control but which one do
> >> > i
> >> > expose in this case. i couldn't find the DataBindings.Add for the
> >> > textbox
> >> > in
> >> > my user control (with the context of being in the user control
> >> > designer).
> >> >
> >> > i guess what i'm asking is what public property do i expose on the user
> >> > control and how do i set it?
> >> >
> >> > thanks,
> >> > rodchar
> >> >
> >> > "Eliyahu Goldin" wrote:
> >> >
> >> >> User control can expose properties. You can make a property that will
> >> >> set
> >> >> the binding expression. Is it what you are after?
> >> >>
> >> >> --
> >> >> Eliyahu Goldin,
> >> >> Software Developer & Consultant
> >> >> Microsoft MVP [ASP.NET]
> >> >>
> >> >>
> >> >> "rodchar" <(E-Mail Removed)> wrote in message
> >> >> news:(E-Mail Removed)...
> >> >> > hey all,
> >> >> > for simplicity's sake i have a single textbox inside a user control.
> >> >> > once
> >> >> > i
> >> >> > drag that user control onto my page is there a way to attach a
> >> >> > binding
> >> >> > expression to it at runtime?
> >> >> >
> >> >> > thanks,
> >> >> > rodchar
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
=?Utf-8?B?cm9kY2hhcg==?=
Guest
Posts: n/a
 
      10-25-2006
ok i tried the databinding with a real datasource instead of the function and
it worked. out of curiosity, is the function suppose to work and maybe my
declaring syntax is incorrect?


"rodchar" wrote:

> sorry for just not getting it, but where do i from? (control page in the
> properties, on on the .aspx page) i tried in both places and i'm not getting
> anything?
>
> "Eliyahu Goldin" wrote:
>
> > call DataBind()
> >
> > --
> > Eliyahu Goldin,
> > Software Developer & Consultant
> > Microsoft MVP [ASP.NET]
> >
> >
> > "rodchar" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I'm not sure what i'm doing wrong:
> > >
> > > <uc1:webusercontrol id="WebUserControl1" runat="server" uctextbox='<%#
> > > "GetTime()" %>'></uc1:webusercontrol>
> > >
> > > defined on the .aspx:
> > > Public Function GetTime() As String
> > > Return DateTime.Now.ToString("T")
> > > End Function
> > >
> > > defined on the control page:
> > > Public Property UcTextBox() As String
> > > Get
> > > Return Me.TextBox1.Text
> > > End Get
> > > Set(ByVal value As String)
> > > Me.TextBox1.Text = value
> > > End Set
> > > End Property
> > >
> > > And the result is that nothing shows up in the textbox.
> > >
> > > "Eliyahu Goldin" wrote:
> > >
> > >> Something like this?
> > >>
> > >> public string TextBinding
> > >> {
> > >> set
> > >> {
> > >> myText.Text = value;
> > >> myText.DataBind();
> > >> }
> > >> }
> > >>
> > >> --
> > >> Eliyahu Goldin,
> > >> Software Developer & Consultant
> > >> Microsoft MVP [ASP.NET]
> > >>
> > >>
> > >> "rodchar" <(E-Mail Removed)> wrote in message
> > >> news:(E-Mail Removed)...
> > >> > yes, i've exposed public properties in a user control but which one do
> > >> > i
> > >> > expose in this case. i couldn't find the DataBindings.Add for the
> > >> > textbox
> > >> > in
> > >> > my user control (with the context of being in the user control
> > >> > designer).
> > >> >
> > >> > i guess what i'm asking is what public property do i expose on the user
> > >> > control and how do i set it?
> > >> >
> > >> > thanks,
> > >> > rodchar
> > >> >
> > >> > "Eliyahu Goldin" wrote:
> > >> >
> > >> >> User control can expose properties. You can make a property that will
> > >> >> set
> > >> >> the binding expression. Is it what you are after?
> > >> >>
> > >> >> --
> > >> >> Eliyahu Goldin,
> > >> >> Software Developer & Consultant
> > >> >> Microsoft MVP [ASP.NET]
> > >> >>
> > >> >>
> > >> >> "rodchar" <(E-Mail Removed)> wrote in message
> > >> >> news:(E-Mail Removed)...
> > >> >> > hey all,
> > >> >> > for simplicity's sake i have a single textbox inside a user control.
> > >> >> > once
> > >> >> > i
> > >> >> > drag that user control onto my page is there a way to attach a
> > >> >> > binding
> > >> >> > expression to it at runtime?
> > >> >> >
> > >> >> > thanks,
> > >> >> > rodchar
> > >> >>
> > >> >>
> > >> >>
> > >>
> > >>
> > >>

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C Programming 45 11-04-2008 12:39 PM
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM
Databinding in a user control that contains another user control StraussGuy@hotpop.com ASP .Net 0 01-07-2005 04:55 PM



Advertisments