Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old February 10th, 2009, 09:34 AM
Authorized User
 
Join Date: Nov 2006
Location: Pune, , India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sanjivbshinde
Default Page.parseControl Problem

Hello Friends,
For dynamically adding textboxes I used Page.parseControl method.
For this method i send following string

String sb="<asp:TextBox ID="txtF_Loanamount" CssClass="text_box_FillData" runat="server" backcolor="#FFC0C0" onchange="ok();" ></asp:TextBox><asp:RegularExpressionValidator ID="RegularExpressionF_Loanamount" runat="server" CssClass="RequiredFieldValidatorCSS" ControlToValidate="txtF_Loanamount" Display="Dynamic" ErrorMessage="<br />Please enter Number only" SetFocusOnError="True" ValidationExpression="[-+]?^[1-9]([0-9]*\.[0-9]+|[0-9]+)*"></asp:RegularExpressionValidator>
"
in my cs file i write
Control ctrl = Page.ParseControl(sb.ToString());
Panel1.controls.add(c);

as in txtF_Loanamount if i enter charators then it show message that
"Please enter Number only"
It works fine if my application is on windows XP

but when i put this in Windows Server 2003 (SP 2)

then it don't shows any error message and that wrong value is saved on button click
so please help me to solve this problem

Thanks,
Sanjiv

  #2 (permalink)  
Old February 10th, 2009, 11:57 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

This is a weird way to add a control to a page, but setting that aside...

Have you actually looked at the rendered HTML/JavaScript from the problem version (WS 2003) vs. the good version (XP) to see where and how they differ?

It's very hard to tell from what you've posted, but I can see there are a lot of quote marks inside that string. Could you have improperly escaped one or more of them? Have you tried using the @ escape character on that string?

Just throwing out a few possibilities...
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #3 (permalink)  
Old February 11th, 2009, 12:36 AM
Authorized User
 
Join Date: Nov 2006
Location: Pune, , India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sanjivbshinde
Default

Hello Lee

Thanks for your quick replay

but if we copy paste that string in aspx page than it show correct controls and validator forget that javascript onchange function.

How can I see that

"endered HTML/JavaScript from the problem version (WS 2003) vs. the good version (XP)"

please help me to solve this problem
  #4 (permalink)  
Old February 11th, 2009, 12:53 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
Originally Posted by sanjivbshinde View Post
Hello Lee

How can I see that

"endered HTML/JavaScript from the problem version (WS 2003) vs. the good version (XP)"
How about doing a View | Source from the browser?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Chapter 2 First Page xtiano77 ASP.NET 3.5 Basics 1 May 7th, 2008 01:00 AM
Problem with refreshing the page fozia_izhar .NET Framework 1.x 1 March 24th, 2007 02:18 PM
Post to Another Page problem Indo77 ASP.NET 2.0 Basics 2 March 8th, 2007 05:31 PM
problem with ASP page dhx10000 ASP.NET 1.0 and 1.1 Basics 4 June 12th, 2006 07:48 PM
Page Loading Problem devteam SQL Server 2000 1 January 9th, 2006 12:43 PM





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