473,385 Members | 2,003 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,385 software developers and data experts.

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


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
5 7989
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

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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sky | last post by:
What makes something a valid DataSource? What methods/iterators/etc? Why do I ask? I do understand that a DataSet is based on an XML structure...but it's too table structured for what I am...
4
by: dyw55a | last post by:
Donna Mar 15, 10:11 am show options Newsgroups: microsoft.public.dotnet.framework.adonet From: "Donna" <dyw...@yahoo.com> - Find messages by this author Date: 15 Mar 2005 10:11:56 -0800...
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
6
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the...
3
by: h | last post by:
Hi, I have set my textbox's maxlength property to 1 , however it allow more than one word. Is there any settings that I am missing ? Thanks in advance Hardik Shah
1
by: Pieter | last post by:
Hi, I have a Report (VB.NET 2005), and I'm using Objects as DataSource. I have the object objCompany, which contains a public property MyAdress (instance of objAdress). objAdress has a propert...
2
by: Kelly | last post by:
I'm fairly new to ASP.NET2, but I have an ASP 3.0 background, and I've been experimenting with the DataSource and FormView widgets. I wound up having some questions along the way which I hope you...
0
by: =?Utf-8?B?RG91YnQgb2YgUmFqZWV2IEFN?= | last post by:
Dear all I require certain clarification on following line. This is regarding causesvalidation property of visualstudio 2005 controls. Iam using windows forms not web forms. Inorder to...
1
by: sajithamol | last post by:
The problem is that, in VS2003 using web forms, the text control had a property - "Databinding" that simplified connecting the control to a datasource. It could be done visually during design and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.