Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Monday, March 26, 2012

passing values in html

Is this the right way topass values to query string
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Admin.aspx?Token=ABC">Go To Admin Page</asp:HyperLink></div>"bobby" <bobby@.discussions.microsoft.comwrote in message
news:5BD2FD98-37E7-4311-A29A-F82D26B80CC2@.microsoft.com...

Quote:

Originally Posted by

Is this the right way to pass values to query string
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Admin.aspx?Token=ABC">Go To Admin
Page</asp:HyperLink></div>


Yes, assuming there is an opening <divtag a bit further up...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
There is more than one "right way" to do this kind of thing, but the
technique you've shown is indeed valid.

Here are some other ways to pass data around too:
http://SteveOrr.net/articles/PassData.aspx
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"bobby" <bobby@.discussions.microsoft.comwrote in message
news:5BD2FD98-37E7-4311-A29A-F82D26B80CC2@.microsoft.com...

Quote:

Originally Posted by

Is this the right way topass values to query string
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Admin.aspx?Token=ABC">Go To Admin
Page</asp:HyperLink></div>

Friday, March 16, 2012

Password control

Is there a webforms equivalent to the HTML password box control?
I don't see one in the toolbox.

RegardsJust use the Textbox control and set its TextMode property to password:

<asp:TextBox id="TextBox1" runat="server"
TextMode="Password"></asp:TextBox
"Jerry" <JerryOfBorg@.Yahoo.com> wrote in message
news:%23gzS8pQ8DHA.1596@.TK2MSFTNGP10.phx.gbl...
> Is there a webforms equivalent to the HTML password box control?
> I don't see one in the toolbox.
> Regards
Thanks Ken.

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:OFmMCyQ8DHA.1052@.TK2MSFTNGP12.phx.gbl...
> Just use the Textbox control and set its TextMode property to password:
> <asp:TextBox id="TextBox1" runat="server"
> TextMode="Password"></asp:TextBox>
>
> "Jerry" <JerryOfBorg@.Yahoo.com> wrote in message
> news:%23gzS8pQ8DHA.1596@.TK2MSFTNGP10.phx.gbl...
> > Is there a webforms equivalent to the HTML password box control?
> > I don't see one in the toolbox.
> > Regards

password field: Syntax error in INSERT INTO statement.

Hello,
I am trying to execute ADO.NET INSERT statement where one of the
fields
is coming from a password HTML control. When I access the text with
password.Value and print with Response.Write so as to check that it
is working correctly it displays just fine. However, whenever I
include the password field in one of the SQL INSERT statement's
fields I get the following error:
Exception Details: System.Data.OleDb.OleDbException: Syntax error in
INSERT INTO statement.
Line 85: cmd.ExecuteNonQuery();
When I delete the password field from the insert statement things work
fine (so the problem is no longer related to NTFS file permissions).
Any ideas on how to solve this problem would be greatly appreciated.
Best Regards,
NeilNeil, it's difficult to pinpoint your problem without seeing some code; but
here are a few ideas to get you started;
If you're using a WebControls textbox (and not an HtmlControls input box),
then the correct accessor would be something like txtPassword.Text
Triple-check your SQL. Try modifying it so that the value you're entering
in the textbox is manually assigned to the SqlParam (or embedded in your sql
string, etc). That will help you debug your SQL, your schema, etc while
removing the textbox from the equation.
Try very simple passwords, e.g. "a". If that succeeds, you might be having
a problem with unescaped apostrophes or something similar.
If you can, display the generated Sql in a Trace.Write or a Response.Write,
and copy/paste it into your Sql tool to test it manually.
Best of luck,
/// M
"Neil Zanella" <nzanella@.gmail.com> wrote in message
news:1ac72686.0501221942.349922c2@.posting.google.com...
> Hello,
> I am trying to execute ADO.NET INSERT statement where one of the
> fields
> is coming from a password HTML control. When I access the text with
> password.Value and print with Response.Write so as to check that it
> is working correctly it displays just fine. However, whenever I
> include the password field in one of the SQL INSERT statement's
> fields I get the following error:
> Exception Details: System.Data.OleDb.OleDbException: Syntax error in
> INSERT INTO statement.
> Line 85: cmd.ExecuteNonQuery();
> When I delete the password field from the insert statement things work
> fine (so the problem is no longer related to NTFS file permissions).
> Any ideas on how to solve this problem would be greatly appreciated.
> Best Regards,
> Neil
Hello,
Thank you for your reply. I have already tried everything
you suggested. I also had a problem with calling
Response.Write to debug my SQL query as
whenever I use it the parameter holders
which begin with @. are not substituted
when I call Response.Write (is there
some special method I can call on
OleDbCommand to print the actual
query with the parameters
substituted in?)
Anyways, here was my problem: as strange as
it may sound, I renamed a field called "password"
in MS Access to "foo" and did the same in the
query contained in the code. I don't know how
come but that fixed it. Is there something
special about calling a table's field
"password" in MS Access which
causes the query error I was
experiencing'
Thanks,
Neil
It might be a reserved word in Access. In Sql Server you can use most
reserved words as column names, but you reference them in your sql using
[brackets].
Since you've identified it as an Access or .NET->Access issue, I'd also try
seaching some of those newsgroups.
<nzanella@.gmail.com> wrote in message
news:1106607939.521494.187670@.f14g2000cwb.googlegroups.com...
> Hello,
> Thank you for your reply. I have already tried everything
> you suggested. I also had a problem with calling
> Response.Write to debug my SQL query as
> whenever I use it the parameter holders
> which begin with @. are not substituted
> when I call Response.Write (is there
> some special method I can call on
> OleDbCommand to print the actual
> query with the parameters
> substituted in?)
> Anyways, here was my problem: as strange as
> it may sound, I renamed a field called "password"
> in MS Access to "foo" and did the same in the
> query contained in the code. I don't know how
> come but that fixed it. Is there something
> special about calling a table's field
> "password" in MS Access which
> causes the query error I was
> experiencing'
> Thanks,
> Neil
>

password field: Syntax error in INSERT INTO statement.

Hello,

I am trying to execute ADO.NET INSERT statement where one of the
fields
is coming from a password HTML control. When I access the text with
password.Value and print with Response.Write so as to check that it
is working correctly it displays just fine. However, whenever I
include the password field in one of the SQL INSERT statement's
fields I get the following error:

Exception Details: System.Data.OleDb.OleDbException: Syntax error in
INSERT INTO statement.

Line 85: cmd.ExecuteNonQuery();

When I delete the password field from the insert statement things work
fine (so the problem is no longer related to NTFS file permissions).

Any ideas on how to solve this problem would be greatly appreciated.

Best Regards,

NeilNeil, it's difficult to pinpoint your problem without seeing some code; but
here are a few ideas to get you started;

If you're using a WebControls textbox (and not an HtmlControls input box),
then the correct accessor would be something like txtPassword.Text

Triple-check your SQL. Try modifying it so that the value you're entering
in the textbox is manually assigned to the SqlParam (or embedded in your sql
string, etc). That will help you debug your SQL, your schema, etc while
removing the textbox from the equation.

Try very simple passwords, e.g. "a". If that succeeds, you might be having
a problem with unescaped apostrophes or something similar.

If you can, display the generated Sql in a Trace.Write or a Response.Write,
and copy/paste it into your Sql tool to test it manually.

Best of luck,

/// M

"Neil Zanella" <nzanella@.gmail.com> wrote in message
news:1ac72686.0501221942.349922c2@.posting.google.c om...
> Hello,
> I am trying to execute ADO.NET INSERT statement where one of the
> fields
> is coming from a password HTML control. When I access the text with
> password.Value and print with Response.Write so as to check that it
> is working correctly it displays just fine. However, whenever I
> include the password field in one of the SQL INSERT statement's
> fields I get the following error:
> Exception Details: System.Data.OleDb.OleDbException: Syntax error in
> INSERT INTO statement.
> Line 85: cmd.ExecuteNonQuery();
> When I delete the password field from the insert statement things work
> fine (so the problem is no longer related to NTFS file permissions).
> Any ideas on how to solve this problem would be greatly appreciated.
> Best Regards,
> Neil
Hello,

Thank you for your reply. I have already tried everything
you suggested. I also had a problem with calling
Response.Write to debug my SQL query as
whenever I use it the parameter holders
which begin with @. are not substituted
when I call Response.Write (is there
some special method I can call on
OleDbCommand to print the actual
query with the parameters
substituted in?)

Anyways, here was my problem: as strange as
it may sound, I renamed a field called "password"
in MS Access to "foo" and did the same in the
query contained in the code. I don't know how
come but that fixed it. Is there something
special about calling a table's field
"password" in MS Access which
causes the query error I was
experiencing??

Thanks,

Neil
It might be a reserved word in Access. In Sql Server you can use most
reserved words as column names, but you reference them in your sql using
[brackets].

Since you've identified it as an Access or .NET->Access issue, I'd also try
seaching some of those newsgroups.

<nzanella@.gmail.com> wrote in message
news:1106607939.521494.187670@.f14g2000cwb.googlegr oups.com...
> Hello,
> Thank you for your reply. I have already tried everything
> you suggested. I also had a problem with calling
> Response.Write to debug my SQL query as
> whenever I use it the parameter holders
> which begin with @. are not substituted
> when I call Response.Write (is there
> some special method I can call on
> OleDbCommand to print the actual
> query with the parameters
> substituted in?)
> Anyways, here was my problem: as strange as
> it may sound, I renamed a field called "password"
> in MS Access to "foo" and did the same in the
> query contained in the code. I don't know how
> come but that fixed it. Is there something
> special about calling a table's field
> "password" in MS Access which
> causes the query error I was
> experiencing??
> Thanks,
> Neil