rasul moh

rasul moh

  • NA
  • 79
  • 85.2k

how to use html input text in C#

Aug 23 2013 1:06 AM
how to use html input text in aspx.cs page without using runat="server"

Default.aspx:

<input id="txtname" type="text" value="" />


Default.aspx.cs:

string aa="hello";

txtname.value =aa; ---> how to use
//string value pass to textbox how?
//how to call this txtname(textbox) in cs page ?

Reply me quick....................
help me plzzzzzzzzzzzzzzzzzz

Answers (3)

2
rasul moh

rasul moh

  • 0
  • 79
  • 85.2k
Aug 23 2013 3:30 AM

ASPX Page:


 Session["address"] = TextBox1.Text.ToString();


HTML Page:
<input type="text" size="34" name="address" value="<%=Session["address"].ToString()%>" id="text1" />

0
Iftikar Hussain

Iftikar Hussain

  • 0
  • 12.6k
  • 448.6k
Aug 23 2013 3:57 AM
for binding the value declare one public variable 
public string Data;

in your code

public string Data;
protected void Page_Load(object sender, EventArgs e)
        {
            Data = "Test";
            DataBind();
}

and in your aspx

<input id="txtname" type="text" value="<%= Data %>" />

Regards,
Iftikar
-3
Iftikar Hussain

Iftikar Hussain

  • 0
  • 12.6k
  • 448.6k
Aug 23 2013 1:09 AM
Hi,
        Here it is

string data=Request.Form["txtname"];

Regards,
Iftikar