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