-1

This should be easy. I have seen multiple answers where this has been implemented with the way discribed below but for some reason i can't make it work for me.
I have seen this for example which i think i understood it here, so for my (part of) code which is <input id="myPassword" type="password" />i tried doing myPassword.Textwhich does not seem to work.
Is there anything wrong with the above?

Community
  • 1
  • 1
mpla_mpla
  • 313
  • 1
  • 2
  • 12
  • If you want to get it server side like `Request["password"]` you need to have a `name="password"` attribute / if you want to get it like `myPassword.Text` you have to have `runat="server"` attribute. – Davor Zlotrg Jul 12 '15 at 14:26

2 Answers2

0

myPassword.value (input elements have a value attribute, see W3Schools

If you are interested in server side access then try using

<asp:TextBox runat="server" TextMode="Password" id="myPassword" />
Neil Stevens
  • 3,534
  • 6
  • 42
  • 71
  • What i want is like i am taking the value from a regular textbox in VS (`username1.Text`), to take the value from a type = ''password'' textbox. How can this be done? – mpla_mpla Jul 12 '15 at 11:52
0

You can try any of these two. Easiest one is to make run at server.

 <input id="myPassword1" type="password" />
 <input id="myPassword2" type="password" runat ="server" />

 string pwd1 = String.Format("{0}", Request.Form["myPassword1"]);
 string pwd2 = myPassword2.Value;
Raj Karri
  • 551
  • 4
  • 19
  • I have been able to do it with `` to take the value by using `string password2 = Request.Form["myPassword2"];` so i don't think the run at sever is necessary – mpla_mpla Jul 13 '15 at 06:55