The reason why the Asp.net Password box cannot get the value

Source: Internet
Author: User

I am installing a database in a multi-page program. The first page is the user protocol, and the second page is the user database settings .. Hide pages one by one

During debugging, all textbox values of textmode = "password" are "", and other textbox inputs are normal,

Found the cause:
When displayed on the page, set the visible of the Panel in which the password input box is located to false, and the obtained value of the password is, I have read about hiding the password input box and cannot obtain the value. I didn't expect this to be the same.

Sub pagechange (byval pageid as int16)

Panel_readme.visible = false
Panel_set.visible = false
Panel_install.visible = false
Panel_finish.visible = false

 

In order to flip the page without losing the password, the session is used to save the password before panel_set.visible = false, which solves the above problem.

 

The code before modification is as follows:

Protected sub checkbox_accpet_checkedchanged (sender as object, e as system. eventargs) handles checkbox_accpet.checkedchanged <br/> if me. checkbox_accpet.checked then <br/> bt_next.enabled = true <br/> else <br/> bt_next.enabled = false <br/> end if <br/> end sub </P> <p> protected sub bt_next_click (sender as object, e As system. eventargs) handles bt_next.click <br/> dim AA as int16 = Val (install_step.text) <br/> If AA> = 1 and AA <= 3 then </P> <p> AA = AA + 1 <br/> install_step.text = AA <br/> end if <br/> pagechange (aa) </P> <p> end sub </P> <p> protected sub bt_pre_click (sender as object, e as system. eventargs) handles bt_pre.click <br/> dim AA as int16 = Val (install_step.text) </P> <p> If AA> = 2 and AA <= 4 then <br/> AA = AA-1 <br/> install_step.text = AA <br/> end if <br/> pagechange (aa) </P> <p> end sub </P> <p> sub pagechange (byval pageid as int16) </P> <p> panel_readme.visible = false <br/> panel_set.visible = false <br/> panel_install.visible = false <br/> panel_finish.visible = false <br/> bt_next.text =" </P> <p> panel_finish.visible = false <br/> select case pageid <br/> case 1 </P> <p> panel_readme.visible = true </P> <p> bt_pre.enabled = false <br/> bt_next.enabled = true <br/> case 2 </P> <p> panel_set.visible = true </P> <p> bt_pre.enabled = true <br/> bt_next.enabled = true </P> <p> case 3 </P> <p> panel_install.visible = true </P> <p> bt_pre.enabled = true <br/> bt_next.enabled = true </P> <p> case 4 </P> <p> panel_finish.visible = true </P> <p> bt_pre.enabled = false <br/> bt_next.enabled = true <br/> bt_next.text = "end to" <br/> end select <br/> end sub </P> <p> protected sub bt_db_click (sender as object, e As system. eventargs) handles bt_db.click <br/> dim db_server, db_user, db_name, db_port, db_pwd as string <br/> dim ad_username, ad_pwd as string <br/> if not ispostback then <br/> ad_pwd = adminpwd. text <br/> end if </P> <p> bt_next.enabled = false </P> <p> db_server = dbserver. text <br/> db_port = dbport. text <br/> db_pwd = dbpwd. text <br/> db_user = dbusername. text <br/> db_name = dbname. text <br/> ad_username = adminusername. text <br/> ad_pwd = adminpwd. text <br/> dim connstr as string <br/> connstr = string. format ("Server = {0}; user = {1}; database = {2}; Port = {3}; Password = {4}; charset = gb2312", db_server, db_user, db_name, db_port, db_pwd) </P> <p> dim myconn as mysqlconnection = new mysqlconnection <br/> myconn. connectionstring = connstr </P> <p> 'try </P> <p> myconn. open () </P> <p> 'read the SQL file </P> <p> 'Open the SQL file <br/> 'dim SQL as string = "" <br/> dim filename as string = server. mappath ("SQL. SQL ") <br/> dim filestream as streamreader <br/> filestream = file. opentext (filename) <br/> dim outsqllist as string = "" 'output string to the display list <br/> dim table, SQL as string <br/> while filestream. peek () <>-1 <br/> table = filestream. readline () <br/> SQL = filestream. readline () <br/> outsqllist + = "create table:" & table & "complete" & CHR (13) & CHR (10) <br/> sqllist. TEXT = outsqllist <br/> 'table written to the database <br/> 'db. executenonquery ("") <br/> 'update the Administrator name and password <br/> mysqlhelper. executenonquery (myconn, "Update B _member set username = '" & ad_username & "', Pwd = '" & getmd5 (ad_pwd, 32 )&"'") </P> <p> end while <br/> filestream. close () </P> <p> myconn. close () <br/> myconn. dispose () </P> <p> bt_db.enabled = false <br/> bt_next.enabled = true <br/> 'write configuration file <br/> 'configurationmanager. connectionstrings ("localmysqlserver "). connectionstring <br/> 'configurationmanager. connectionstrings. </P> <p> 'catch ex as exception <br/> 'sqllist. TEXT = "Incorrect database configuration information. Please reconfigure" <br/> 'bt_pre.enabled = true <br/> 'end try <br/> end sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.