473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

user control and databinding expression

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
Oct 25 '06 #1
7 1717
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
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

Oct 25 '06 #2
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
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


Oct 25 '06 #3
Something like this?

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

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:57**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microso ft.com...
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



Oct 25 '06 #4
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" <ro*****@discussions.microsoft.comwrote in message
news:57**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
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


Oct 25 '06 #5
call DataBind()

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:57**********************************@microso ft.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microso ft.com...
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



Oct 25 '06 #6
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" <ro*****@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:57**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
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



Oct 25 '06 #7
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" <ro*****@discussions.microsoft.comwrote in message
news:89**********************************@microsof t.com...
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" <ro*****@discussions.microsoft.comwrote in message
>news:57**********************************@microso ft.com...
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" <ro*****@discussions.microsoft.comwrote in message
>news:1A**********************************@microso ft.com...
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
>>
>>
>>
>>
>>
>>
Oct 25 '06 #8

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

Similar topics

3
by: Roshawn Dawson | last post by:
Hi, I have a repeater control. This control will render a number of textboxes on the page. Each textbox has its onblur event wired to a JScript function. Here's a sample: <asp:textbox...
2
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: ...
2
by: ¥øÃZ½Þ | last post by:
Dear All I have write a user control which is uses to popup a new browser and inherited ImageButton It have a user defined property named url and in the aspx page, the code like this ...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
2
by: bpd | last post by:
I have a user control embedded in a gridview as an EditItemTemplate. When updating, the value is not saved to the database. I have an SQLDataSource attached to the Gridview. Can someone point me...
1
by: Dave | last post by:
I have the following ASP.NET 2.0 code (simplified here for ease): <asp:Repeater id="SearchResultsRepeater" runat="server"> <ItemTemplate> <uc:SearchResult ID="SearchResult"...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
3
by: HP | last post by:
Hi there I've asked about it few times, and seen it asked more times, but no one ever replied. The question is: is it possible to use a control inside of user control (eg. dropdownlist) as a...
0
by: Dave A | last post by:
I have a user control that is dynamically loaded into a repeater; (so the user control appears several times) The user control features a text box and a delete button. When the delete button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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,...
0
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...
0
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
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,...

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.