Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Single-Value Data Binding on TextBox...

Reply
Thread Tools

Single-Value Data Binding on TextBox...

 
 
Julius Fenata
Guest
Posts: n/a
 
      03-03-2005
Dear all,

Need help to bind single-value on textbox.., I have code on code-behind like
this...

private void Page_Load(object sender, System.EventArgs e)
{
if ( ! Page.IsPostBack )
{
BindData();
this.DataBind();
}
}

private void BindData()
{
// Connection
SqlConnection cn_Pubs =
new SqlConnection("server=(local);" +
"uid=sa;" +
"pwd=;" +
"database=pubs");

// Adapter
SqlDataAdapter da_Titles =
new SqlDataAdapter("SELECT title, " +
"notes, " +
"price " +
"FROM titles", cn_Pubs);

// DataSet
DataSet ds_Titles = new DataSet();
da_Titles.Fill(ds_Titles, "titles");
}

And have coded in Web Forms like this...

<asp:TextBox
id=TextBox1
runat="server"
Text='<%# DataBinder.Eval(ds_Titles, "title") %>'>
</asp:TextBox>

But Compiler throw error message like this...

CS0103: The name 'ds_Titles' does not exist in the class or namespace
'ASP.WebForm1_aspx'


How to resolve this problem..?

Thx,
Julius F


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView binding - how to stop initial binding Amit ASP .Net 6 10-24-2006 08:06 AM
pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe) kogrover@gmail.com Python 2 10-20-2006 04:08 PM
Complex data binding question, binding child objects of a custom collection. JcFx ASP .Net Datagrid Control 0 06-01-2005 04:01 PM
Data Binding - using inline code vs. functions vs. straight binding Jordan ASP .Net 2 02-10-2004 08:32 PM
value binding and function binding Vivek Nallur Ruby 0 09-25-2003 02:52 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57