Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement some options on the page for prompt judgment by ASP.NET

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces ASP.NET how to achieve some options on the page to prompt and judge, the article is very detailed, has a certain reference value, interested friends must read it!

The following is divided into two situations. Analyze through ext control and asp control respectively.

1. If it is an asp control, you need to obtain the id of the current control when prompted. You can get the corresponding options by querying the source code.

Id.

two。 If it is an ext control, you can prompt for an option and directly get the id of the control in the aspx design.

Prompt it with the following js function.

The copy code is as follows:

Function YANDNCheck () {

If (document.getElementById ("txtName")! = null) {

If (document.getElementById ("txtName"). Value = "") {

Alert ('name cannot be empty!')

Document.getElementById (txtName) .focus ()

Return false

}

}

Return true

}

The first kind: the judgment information of asp control

The copy code is as follows:

Function YANDNCheck () {

If (document.getElementById ("id corresponding to textbox in source code")! = null) {

If (document.getElementById ("current id corresponding to textbox in source code") .value = "") {

Alert ('name cannot be empty!')

Document.getElementById ("current id corresponding to textbox in source code"). Focus ()

Return false

}

}

Return true

}

Foreground display of asp control

The copy code is as follows:

Name:

The second kind: the judgment information of ext control

The copy code is as follows:

Function YANDNCheck () {

If (document.getElementById ("txtName")! = null) {

If (document.getElementById ("txtName"). Value = "") {

Alert ('name cannot be empty!')

Document.getElementById (txtName) .focus ()

Return false

}

}

Return true

}

Foreground display information of ext control: just call the id of the corresponding control directly

The copy code is as follows:

Name:

The above is all the contents of this article entitled "how to make a prompt judgment on some options on the page by ASP.NET". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report