0

Can i bind my data with textbox in asp.net using c# sorry to ask this silly question

if yes than how to bind it as if we use VC# the text box has the option data binding in property ''

in asp.net i am not getting it

plz can any help me out ?

1

3 Answers 3

1

Yes, you can. It's been possible since ASP.NET 1.0.

Sign up to request clarification or add additional context in comments.

Comments

0

To store the value of the database providers to textbox, the process could be like this,

 DataSet ds = mySqlDataAdapter.Fill(ds,"xyz");

 txtName.Text = ds.Tables[0].Rows[0]["NameField"].ToString();
 txtField2.Text = ds.Tables[0].Rows[0]["Field2"].ToString();

Even from the Data Reader you can bind the data to textbox in the similar manner.

Comments

0

Your C# function could be:

void Page_Load() { 
 txt1.Text = "Hello World"; 
}

Your ASP.NET code could be:

<form runat="server">
<asp:TextBox id="txt1" runat="server" />
</form>

Hope that helps!

1 Comment

bro i wanna bind my database with it so this not i want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.