betteroutthanin
betteroutthanin

Reputation: 7546

how to change textbox text in client side with c# script

Is that possible to change the textbox text in the client side with c# script(Not javascript). Here is what I tried, but it doesn't work:

<asp:TextBox ID="Dis" runat="server">Old text</asp:TextBox>

<%Dis.Text = "New Text"; %>

Upvotes: 0

Views: 666

Answers (2)

chandresh patel
chandresh patel

Reputation: 309

Only using ajax request which is clearly not your requirement.

Upvotes: 1

Christos
Christos

Reputation: 53958

No it's not possible. C# is used for writing the server side code in web applications -when we have to do with web apps. I point out this because C# can be used to build almost everything. Whatever has to do with the client, you have to programm it in plain javascript or using a javascript framework. As far as how you will change the text of your textbox, it depends on when you want to do so. I mean which will be the event, which will trigger this change. If you specify this, I could post here some code to show you how you can achieve this.

UPDATE

When you refer to C# script, you possibly refer to the C# code we sometimes write inside our html pages using <% %>. Yeah, in this respect you can say that C# scripts exist. However, this code runs at the server, and then the created html page goes from the server to the client.

Upvotes: 2

Related Questions