| |

VerySource

 Forgot password?
 Register
Search
View: 1100|Reply: 8

How to find the html control in .cs and retrieve its value

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 United States

Post time: 2020-12-15 18:00:02
| Show all posts |Read mode
How to find the html control in .cs and retrieve its value
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 France

Post time: 2020-12-15 18:15:01
| Show all posts
Put the html control run="server"
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-12-15 18:30:01
| Show all posts
Html control?
If it is runat=server

You can use Page.Controls.FindControl(ControlID); to get the control
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-15 21:30:01
| Show all posts
If your html control is embedded;
Button button1=(Button)e.Item.FindControl("Button1"); Button1 is the ID.
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-12-15 23:00:01
| Show all posts
Cycle through all controls on the page to find the name of the corresponding control
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-12-19 09:45:01
| Show all posts
You can also pass the html control to hidden hidden, and then read it in the cs file.
Reply

Use magic Report

0

Threads

21

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-19 10:15:01
| Show all posts
<input type="text" runat="server" id="txtUserName" />

txtusername.value
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-12-19 11:00:01
| Show all posts
Ok. The above methods are fine.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-19 14:00:01
| Show all posts
Set the run="server" of the control
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list