Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 March 3rd, 2009, 08:11 AM
Authorized User
Join Date: Jan 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Post convertion

HTML Code:
<input type="text" name="v1" value="<%= Request["v1"] %>">
i need to convert that code into asp.net

and i converted like


is the above code is correct
Old March 3rd, 2009, 01:56 PM
Friend of Wrox
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default What language?

is it to be VB.net or C#? Looks Like C#...

either way you would need something similar to:

<asp:TextBox ID="txt1" runat="server" ><%= Request["v1"].ToString%></asp:TextBox>
Jason Hall

Follow me on Twitter @jhall2013
Old March 8th, 2009, 11:59 PM
Authorized User
Join Date: Apr 2008
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts

Originally Posted by vamshidhar View Post
HTML Code:
<input type="text" name="v1" value="<%= Request["v1"] %>">
i need to convert that code into asp.net

and i converted like


is the above code is correct
to be as follows

find the single quotes. or else you need to escape the double quotes in your earlier query
Pon Saravanan
Old March 9th, 2009, 08:45 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

Hmm. While you most certainly can do things this way, I would not recommend it. While it was certainly the norm in the days of Classic ASP to mix Server code in with HTML that model has somewhat been broken with ,NET (Unless of course you are using .NET MVC then this type of paradigm is the way to go).

Since you are conveting a standard HTML Input into a .NET Textbox Server Control you could do something like this:

csharp Code:
protected void Page_Load(object sender, EventArgs e)
    TextBox1.Text = Reqest["v"];

that way the code on the aspx page would simply look like this:

<asp:TextBox ID="TextBox1" runat="server" />

This keeps your UI code much cleaner and helps prevent management nightmares down the road.

Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convertion of CRect* to ULONG arun.sharma.kumar Visual C++ 1 June 5th, 2007 03:33 AM
pdf to word convertion amartya_mandal ASP.NET 1.0 and 1.1 Professional 2 April 17th, 2007 02:27 PM
XSLT convertion help mwells XSLT 3 February 2nd, 2007 10:00 AM
Convertion schanda ASP.NET 1.0 and 1.1 Professional 1 March 23rd, 2006 02:53 PM
Convertion using Masks rtr1900 Classic ASP Databases 2 November 29th, 2005 06:28 AM

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