Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic 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 January 20th, 2005, 08:49 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET custom controls


anyone seen any good articles on OnPreRender

the javascript

i have created a custom validation control to check wither a user either ticks a checkbox or enters text in a textbox

server side is fine

got an extra property to take in the name of the second control to validate


i have this code which does actually do the job

  sb_Script.Append( "var val = document.all[document.all[\"" );
    sb_Script.Append( this.ID );
    sb_Script.Append( "\"].controltovalidate];" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "var col = val.all;" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "if ( col != null ) {" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "for ( i = 0; i < col.length; i++ ) {" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "if (col.item(i).tagName == \"INPUT\") {" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "if ( col.item(i).checked ) {" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "\r" );
    sb_Script.Append( "return true;" );


however its not very neat

what are the new rules for getting an object into javascript

while since i've used javascript but i think you used to be able to do

var chbox1 = document.form1.checkbox1

then access the properties of chbox1

any one know of any good what asp.net has done to javascript articles?

 
Old January 20th, 2005, 11:42 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

.NET? - This is the classic ASP area

Anyhow, here is JS function that checks: is it checked or uncheked

function chqBoxState(oneelement)
{
   var status = 'unChecked';
   if (oneelement.checked)
   {
      status = 'checked';
      alert('You have ' + status + ' the checkbox ');
   }
   else
   {
      alert('You have ' + status + ' the checkbox);
   }

}

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Design-Time Debugging of ASP.NET Custom Controls robzyc ASP.NET 2.0 Basics 0 July 2nd, 2008 06:29 AM
Custom HTTP 404 Problem w/ASP to ASP.NET kwilliams ASP.NET 2.0 Professional 7 November 26th, 2007 04:17 PM
asp.net 2 custom membership provider andyw ASP.NET 2.0 Professional 24 September 6th, 2006 08:31 AM
Custom Icon for ASP.NET Control bmains ASP.NET 2.0 Basics 0 September 22nd, 2004 05:09 PM





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