Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2010, 07:38 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default how to put value into html button?

i trying to put a intger into
<%

Dim i As Integer
i = 5

%>
<input name="12" type=hidden value='<%# "i" %>' />

its not work,what should i do?
 
Old November 15th, 2010, 08:06 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

If all that code is in the ".aspx" file, then you should be able to just use
Code:
<input name="12" type="hidden" value="<%= i %>" />
Using a name for a form field that isn't a legal variable name is NOT a good idea. It can work, but it can cause problems.
The Following User Says Thank You to Old Pedant For This Useful Post:
nir987 (November 16th, 2010)
 
Old November 16th, 2010, 01:33 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

thanks alot
 
Old November 16th, 2010, 05:17 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

do i know how to do this
Response.Write(<asp:Image ID="Image1" runat="server" ImageUrl="~/LOGO.jpg"/>)
?
 
Old November 16th, 2010, 05:47 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can't do that. Response.Write writes to the output directly, so the control you try to declare is sent as-is, and is not processed at the server.

What exactly are you trying to accomplish?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 16th, 2010, 06:15 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

i want something like a linkbutton.
its work when iwrite it HTML button but its not pretty.


Response.Write("<input type=""hidden"" name=""like"" value=""" & rc.Fields.Item(1).Value & """ /><input type=""submit"" value=""ממליץ"" style=""height: 23px; width: 45px; background-color: #FFFFFF; color: #FF0000"" >")
 
Old November 17th, 2010, 04:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Why not simply use a LinkButton? I don't see anything dynamic here that couldn't be accomplished through code or data binding. E.g.:

yourLinkButton.Text = SomeDynamicTextHere

The code snippet rc.Fields.Item(1).Value reminds me of classic ASP. It looks like you're using or upgrading classic ASP techniques here. Are you sure you're taking enough advantage of the new stuff in ASP.NET and not try to squeeze the classic ASP concepts in the new ASP.NET world?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 17th, 2010, 05:22 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

i know the net version ,but i want to do it in classic way.
 
Old November 17th, 2010, 06:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

But why? There's just some stuf that can't be done the classic way in ASP.NET, such as Response writing a server control.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 17th, 2010, 06:56 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

i can do it in repetar but in response.write i can play more and write better program.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to put a button control in a GridView control ryan.webb ASP.NET 2.0 Basics 2 December 28th, 2007 05:26 AM
HTML Button in Asp.Net vallabh53 .NET Framework 1.x 0 October 17th, 2007 01:01 AM
html button k.manisha ASP.NET 1.0 and 1.1 Professional 0 April 26th, 2007 03:31 AM
make html button default sansircar ASP.NET 1.0 and 1.1 Professional 1 October 23rd, 2006 04:25 PM
put part of html in string DOM Dj Kat Javascript How-To 3 February 22nd, 2006 04:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.