By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Datasource property missing for ASP.NET Textbox in VS.NET 2005

P: n/a

I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to 2005.
Is there some other method available to bind TextBoxes that I am not seeing?

I have seen some articles on the web stating that you can only bind to grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any control
for that matter? This WAS a very useful feature. The control still has a
DataBind() method, but no way to specify DataSource any longer.

Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression builder,
but it is very limited on what can be bound.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Feb 28 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Ken,

This is quite logical as TextBoxes are usually used inside other data bound
controls' templates. This control has just one property that is mostly being
set - Text. So what's the point of assigning datasource to set the text if
it's easier to write myTextBox.Text = dataRow["Column"].ToString()
In addition, it would be mandatory to set datasource of every's text box on
a web form. Imagine you have 10 textboxes, each one represents column's value
for a single record (i.e. firstname, lastname, address, etc.). Is it just
better / easier / faster to group these boxes in one bound control (see
asp.net 2.0 new controls FormView, DetailsView) and assign datasource to it
and call DataBind()

<asp:FormView runat="server" ID="fv">
<itemTemplate>
<asp:TextBox runat="server" ID="firstName" Text='<%# Eval("FirstName") %>'/>
<asp:TextBox runat="server" ID="lastName" Text='<%# Eval("LastName") %>'/>
</itemTemplate>

One more thing. ASP.NET supports enumerable data sources, meaning a record
(an object, or a value) must be wrapped to a IList implementator to support
binding. And also it would be quite inefficient from coding point of view to
assign datasource for every single control:

textBox1.DataSource = whatever1;
textBox1.DataBind();
textBox2.DataSource = whatever2;
textBox2.DataBind();
textBox3.DataSource = whatever3;
textBox3.DataBind();

It's better to do it collectively.

Best Regards
--
Milosz
"Ken Varn" wrote:
>
I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to 2005.
Is there some other method available to bind TextBoxes that I am not seeing?

I have seen some articles on the web stating that you can only bind to grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any control
for that matter? This WAS a very useful feature. The control still has a
DataBind() method, but no way to specify DataSource any longer.

Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression builder,
but it is very limited on what can be bound.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Mar 1 '07 #2

P: n/a

Although I may understand the reasoning behind your explanation, I still
don't understand its justification. So-what if it is the same as assigning
the text value? The thing that is disturbing to me is that this was
available in the older framework and was removed without the slightest hint
of it being deprecated. Thus, any older ASP.NET 1.1 pages that may have
used it are now incompatible with the 2.0 framework if they are to be
migrated.

This is an all-too-familiar problem with Microsoft in that they change
things at the drop of a hat without any regard for downward compatibility,
especially on a .NET Framework that is only one version newer than when this
feature was available.

From purely a coding perspective, it probably does not make sense to have
it, but when using the VS visual designer, it was much more beneficial in
that you could just click and select items to be bound without having to
write the code to do it. And now with two-way binding, it would be even
more beneficial. It just seems a bit odd to remove a piece of functionality
just because someone thought it was not necessary.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:30**********************************@microsof t.com...
Hi Ken,

This is quite logical as TextBoxes are usually used inside other data bound
controls' templates. This control has just one property that is mostly being
set - Text. So what's the point of assigning datasource to set the text if
it's easier to write myTextBox.Text = dataRow["Column"].ToString()
In addition, it would be mandatory to set datasource of every's text box on
a web form. Imagine you have 10 textboxes, each one represents column's
value
for a single record (i.e. firstname, lastname, address, etc.). Is it just
better / easier / faster to group these boxes in one bound control (see
asp.net 2.0 new controls FormView, DetailsView) and assign datasource to it
and call DataBind()

<asp:FormView runat="server" ID="fv">
<itemTemplate>
<asp:TextBox runat="server" ID="firstName" Text='<%# Eval("FirstName") %>'/>
<asp:TextBox runat="server" ID="lastName" Text='<%# Eval("LastName") %>'/>
</itemTemplate>

One more thing. ASP.NET supports enumerable data sources, meaning a record
(an object, or a value) must be wrapped to a IList implementator to support
binding. And also it would be quite inefficient from coding point of view to
assign datasource for every single control:

textBox1.DataSource = whatever1;
textBox1.DataBind();
textBox2.DataSource = whatever2;
textBox2.DataBind();
textBox3.DataSource = whatever3;
textBox3.DataBind();

It's better to do it collectively.

Best Regards
--
Milosz
"Ken Varn" wrote:
>
I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to 2005.
Is there some other method available to bind TextBoxes that I am not
seeing?

I have seen some articles on the web stating that you can only bind to
grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any control
for that matter? This WAS a very useful feature. The control still has a
DataBind() method, but no way to specify DataSource any longer.

Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression builder,
but it is very limited on what can be bound.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Mar 1 '07 #3

P: n/a
Howdy,

I just realised, textbox didn't have datasource property in 1.1 anyway, it's
working exactly the same as it was. And replying your resoning, i can't
really see the point in assigning a datesource to every single box on the
form, it's better to do it colectively.

Best regards
--
Milosz
"Ken Varn" wrote:
>
Although I may understand the reasoning behind your explanation, I still
don't understand its justification. So-what if it is the same as assigning
the text value? The thing that is disturbing to me is that this was
available in the older framework and was removed without the slightest hint
of it being deprecated. Thus, any older ASP.NET 1.1 pages that may have
used it are now incompatible with the 2.0 framework if they are to be
migrated.

This is an all-too-familiar problem with Microsoft in that they change
things at the drop of a hat without any regard for downward compatibility,
especially on a .NET Framework that is only one version newer than when this
feature was available.

From purely a coding perspective, it probably does not make sense to have
it, but when using the VS visual designer, it was much more beneficial in
that you could just click and select items to be bound without having to
write the code to do it. And now with two-way binding, it would be even
more beneficial. It just seems a bit odd to remove a piece of functionality
just because someone thought it was not necessary.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:30**********************************@microsof t.com...
Hi Ken,

This is quite logical as TextBoxes are usually used inside other data bound
controls' templates. This control has just one property that is mostly being
set - Text. So what's the point of assigning datasource to set the text if
it's easier to write myTextBox.Text = dataRow["Column"].ToString()
In addition, it would be mandatory to set datasource of every's text box on
a web form. Imagine you have 10 textboxes, each one represents column's
value
for a single record (i.e. firstname, lastname, address, etc.). Is it just
better / easier / faster to group these boxes in one bound control (see
asp.net 2.0 new controls FormView, DetailsView) and assign datasource to it
and call DataBind()

<asp:FormView runat="server" ID="fv">
<itemTemplate>
<asp:TextBox runat="server" ID="firstName" Text='<%# Eval("FirstName") %>'/>
<asp:TextBox runat="server" ID="lastName" Text='<%# Eval("LastName") %>'/>
</itemTemplate>

One more thing. ASP.NET supports enumerable data sources, meaning a record
(an object, or a value) must be wrapped to a IList implementator to support
binding. And also it would be quite inefficient from coding point of view to
assign datasource for every single control:

textBox1.DataSource = whatever1;
textBox1.DataBind();
textBox2.DataSource = whatever2;
textBox2.DataBind();
textBox3.DataSource = whatever3;
textBox3.DataBind();

It's better to do it collectively.

Best Regards
--
Milosz
"Ken Varn" wrote:

I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to 2005.
Is there some other method available to bind TextBoxes that I am not
seeing?

I have seen some articles on the web stating that you can only bind to
grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any control
for that matter? This WAS a very useful feature. The control still has a
DataBind() method, but no way to specify DataSource any longer.

Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression builder,
but it is very limited on what can be bound.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------



Mar 2 '07 #4

P: n/a
Man do I feel stupid. I could have sworn that it was in the 1.1 framework.
I think that the wording in VS.NET was changed from DataBindings to
Expressions. Maybe that is what threw me off. One other explanation could
be that someone went back in time and altered my past perception of ASP.NET
1.1. Maybe not.

Anyhow, I still think that two-way databinding would be nice for entry
fields. It would minimize some coding by only specifying the bound data in
one portion of code rather than in two (saving and loading).

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:70**********************************@microsof t.com...
Howdy,

I just realised, textbox didn't have datasource property in 1.1 anyway, it's
working exactly the same as it was. And replying your resoning, i can't
really see the point in assigning a datesource to every single box on the
form, it's better to do it colectively.

Best regards
--
Milosz
"Ken Varn" wrote:
>
Although I may understand the reasoning behind your explanation, I still
don't understand its justification. So-what if it is the same as
assigning
the text value? The thing that is disturbing to me is that this was
available in the older framework and was removed without the slightest
hint
of it being deprecated. Thus, any older ASP.NET 1.1 pages that may have
used it are now incompatible with the 2.0 framework if they are to be
migrated.

This is an all-too-familiar problem with Microsoft in that they change
things at the drop of a hat without any regard for downward compatibility,
especially on a .NET Framework that is only one version newer than when
this
feature was available.

From purely a coding perspective, it probably does not make sense to have
it, but when using the VS visual designer, it was much more beneficial in
that you could just click and select items to be bound without having to
write the code to do it. And now with two-way binding, it would be even
more beneficial. It just seems a bit odd to remove a piece of
functionality
just because someone thought it was not necessary.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:30**********************************@microsof t.com...
Hi Ken,

This is quite logical as TextBoxes are usually used inside other data
bound
controls' templates. This control has just one property that is mostly
being
set - Text. So what's the point of assigning datasource to set the text if
it's easier to write myTextBox.Text = dataRow["Column"].ToString()
In addition, it would be mandatory to set datasource of every's text box
on
a web form. Imagine you have 10 textboxes, each one represents column's
value
for a single record (i.e. firstname, lastname, address, etc.). Is it just
better / easier / faster to group these boxes in one bound control (see
asp.net 2.0 new controls FormView, DetailsView) and assign datasource to
it
and call DataBind()

<asp:FormView runat="server" ID="fv">
<itemTemplate>
<asp:TextBox runat="server" ID="firstName" Text='<%# Eval("FirstName")
%>'/>
<asp:TextBox runat="server" ID="lastName" Text='<%# Eval("LastName") %>'/>
</itemTemplate>

One more thing. ASP.NET supports enumerable data sources, meaning a record
(an object, or a value) must be wrapped to a IList implementator to
support
binding. And also it would be quite inefficient from coding point of view
to
assign datasource for every single control:

textBox1.DataSource = whatever1;
textBox1.DataBind();
textBox2.DataSource = whatever2;
textBox2.DataBind();
textBox3.DataSource = whatever3;
textBox3.DataBind();

It's better to do it collectively.

Best Regards
--
Milosz
"Ken Varn" wrote:

I have just started using VS.NET 2005 after using VS.NET 2003. One of
the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to
2005.
Is there some other method available to bind TextBoxes that I am not
seeing?

I have seen some articles on the web stating that you can only bind to
grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any
control
for that matter? This WAS a very useful feature. The control still has
a
DataBind() method, but no way to specify DataSource any longer.

Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression
builder,
but it is very limited on what can be bound.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------




Mar 2 '07 #5

P: n/a
No probs Ken ;]. Two way binding is already there, check <%# Bind() %out.

Regards
--
Milosz
"Ken Varn" wrote:
Man do I feel stupid. I could have sworn that it was in the 1.1 framework.
I think that the wording in VS.NET was changed from DataBindings to
Expressions. Maybe that is what threw me off. One other explanation could
be that someone went back in time and altered my past perception of ASP.NET
1.1. Maybe not.

Anyhow, I still think that two-way databinding would be nice for entry
fields. It would minimize some coding by only specifying the bound data in
one portion of code rather than in two (saving and loading).

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:70**********************************@microsof t.com...
Howdy,

I just realised, textbox didn't have datasource property in 1.1 anyway, it's
working exactly the same as it was. And replying your resoning, i can't
really see the point in assigning a datesource to every single box on the
form, it's better to do it colectively.

Best regards
--
Milosz
"Ken Varn" wrote:

Although I may understand the reasoning behind your explanation, I still
don't understand its justification. So-what if it is the same as
assigning
the text value? The thing that is disturbing to me is that this was
available in the older framework and was removed without the slightest
hint
of it being deprecated. Thus, any older ASP.NET 1.1 pages that may have
used it are now incompatible with the 2.0 framework if they are to be
migrated.

This is an all-too-familiar problem with Microsoft in that they change
things at the drop of a hat without any regard for downward compatibility,
especially on a .NET Framework that is only one version newer than when
this
feature was available.

From purely a coding perspective, it probably does not make sense to have
it, but when using the VS visual designer, it was much more beneficial in
that you could just click and select items to be bound without having to
write the code to do it. And now with two-way binding, it would be even
more beneficial. It just seems a bit odd to remove a piece of
functionality
just because someone thought it was not necessary.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:30**********************************@microsof t.com...
Hi Ken,

This is quite logical as TextBoxes are usually used inside other data
bound
controls' templates. This control has just one property that is mostly
being
set - Text. So what's the point of assigning datasource to set the text if
it's easier to write myTextBox.Text = dataRow["Column"].ToString()
In addition, it would be mandatory to set datasource of every's text box
on
a web form. Imagine you have 10 textboxes, each one represents column's
value
for a single record (i.e. firstname, lastname, address, etc.). Is it just
better / easier / faster to group these boxes in one bound control (see
asp.net 2.0 new controls FormView, DetailsView) and assign datasource to
it
and call DataBind()

<asp:FormView runat="server" ID="fv">
<itemTemplate>
<asp:TextBox runat="server" ID="firstName" Text='<%# Eval("FirstName")
%>'/>
<asp:TextBox runat="server" ID="lastName" Text='<%# Eval("LastName") %>'/>
</itemTemplate>

One more thing. ASP.NET supports enumerable data sources, meaning a record
(an object, or a value) must be wrapped to a IList implementator to
support
binding. And also it would be quite inefficient from coding point of view
to
assign datasource for every single control:

textBox1.DataSource = whatever1;
textBox1.DataBind();
textBox2.DataSource = whatever2;
textBox2.DataBind();
textBox3.DataSource = whatever3;
textBox3.DataBind();

It's better to do it collectively.

Best Regards
--
Milosz
"Ken Varn" wrote:
>
I have just started using VS.NET 2005 after using VS.NET 2003. One of
the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer available from 2003 to
2005.
Is there some other method available to bind TextBoxes that I am not
seeing?
>
I have seen some articles on the web stating that you can only bind to
grid
and list controls. Seems like a step backward to me. Why would the
databinding functionality be removed from TextBox controls or any
control
for that matter? This WAS a very useful feature. The control still has
a
DataBind() method, but no way to specify DataSource any longer.
>
Maybe there is some other way to bind controls better than before, but I
have not found it. The closest thing I found was the Expression
builder,
but it is very limited on what can be bound.
>
>
>
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
>
EmailID = varnk
Domain = Diebold.com
-----------------------------------
>
>
>


Mar 3 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.