How to use the new "Bind()" ?

G

Guest

Hello,
I am trying to use the new "Bind" instead of "DataBinder.Eval" but cannot
see a way to use it in code. Can someone help?. Here is my code that is using
"DataBinder.Eval" which I want to change to "Bind" method.

Sub BindStringColumn(ByVal sender As Object, ByVal e As EventArgs)
Dim lbl2 As Label = CType(sender, Label)
Dim Container As DataGridItem = CType(lbl2.NamingContainer,
DataGridItem)
lbl2.Text = DataBinder.Eval(Container.DataItem, Field2)
End Sub

Thanks,
Ganesh
 
G

Guest

Bind should be used declaritively as bellow

<asp:TextBox ID="ProductNameTextBox" runat="server" Text='<%#
Bind("ProductName") %>'>

Note the text property of the textbox

You can also return to you local MSDN for databinding expressions on
ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_aspnetcon/html/14cdd57d-0f82-4667-b503-73e1a96f136a.htm

or on msdn website on:
http://msdn2.microsoft.com/en-us/library/ms178366.aspx

Reagrds
 
G

Guest

Yes, I see that but how would I use that syntax in a ItemTemplate..
Basically, the syntax you have given will work in the aspx page but how would
I use the same in codebehind?.

Thanks for your help!
Ganesh
 
G

Guest

I don't think you can use it the same way, specially that Bind is not member
of DataBinder Class

--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top