Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 December 10th, 2004, 03:31 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Webforms??

As an old ASP programmer I'm used to being able to add and remove form fields as needed.
For example, I can use the same page for adding or editing by simply changing the button.
More importantly, for different circumstances I can make form fields show up, or not by using If statements.
Also, for button actions I can put up an alert like:
'Are you sure you want to delete this company?'

I'm writing an ASP.NET application using C#.
Is there any way I can do this stuff using Webforms?
I'm particularly concerned with the message box for a delete action.

__________________
http://www.softlinksys.com
Professional Software Developer since 1994.
 
Old December 10th, 2004, 06:46 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For anyone interested, I found a bunch of ways to use client side script to control server side controls.
For gaining control of the 'submit' of a form I found this to be real easy and quite effective.
In my Page_Load proc I add this:
<code>
RegisterOnSubmitStatement("submit", "return SubmitMe;");
btnDelete.Attributes["onclick"]="javascript:delRec();";
</code>
Then on the client side I add a javascript (and didn't have to register it):
<code>
<SCRIPT Language="Javascript">
        var fm;
    var SubmitMe = true;
    function Body_Onload()
    {
        fm = document.fmUpdate;
        return;
    }
    function delRec()
    {
        if(!confirm("Do you want to delete this branch and it's users?"))
        {
            SubmitMe = false;
        }else{
            SubmitMe = true;
        }
    }
    //-->
</SCRIPT>
</code>






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET and C# Webforms rtomanio ASP.NET 2.0 Basics 2 September 2nd, 2008 08:58 PM
DateTime Control for WebForms avats ASP.NET 1.0 and 1.1 Professional 2 July 13th, 2007 10:25 PM
Administrator webforms nabeelalkaff BOOK: ASP.NET Website Programming Problem-Design-Solution 2 September 10th, 2006 11:09 AM
VS.NET 2003 Webforms jerrylan BOOK: Professional Crystal Reports for VS.NET 3 April 30th, 2005 07:02 PM
messagebox in webforms nmohammadi Forum and Wrox.com Feedback 2 June 6th, 2003 06:04 PM





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