Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution 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 July 11th, 2003, 10:39 AM
Authorized User
 
Join Date: Jun 2003
Location: New orleans, Louisiana, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default converting Forum.aspx to Forum.ascx (help)

Has any one converted a ASPX to ASCX that has client side javascript functions. For Example:

It is very hard to find client side scripting support online, and off line for asp.net.

Problem:

The Forum is a great application, but I would love to use it other applications.

I'm trying to convert the /Forums/Default.aspx to /Forums/Default.ascx
and also /Forums/Postmessage.aspx to postmessage.ascx

I was successful at getting all of the Modules including the Forum to run in the IBUYSPY Portal environment with the exception of the Javascript functions located on the ASPX pages mentioned above.

** The entire forum runs very well with exception of the Delete Functions and the InsertTag Function.

 I have converted the Delete function as follows
<code>
<!--<script language="javascript">

function DeleteForum(id)

{

if (confirm('Are you sure that you want to delete this forum and all its discussions?'))

{

document.forms['Default'].elements['_ctl0:paramId'].value = id;

__doPostBack('DeleteForum', '');

}

}

function DeleteCategory(id)

{

if (confirm('Are you sure that you want to delete this category and all its sub-forums?'))

{

document.forms['Default'].elements['_ctl0:paramId'].value = id;

__doPostBack('DeleteCategory', '');

}

}

</script> -->
</code>

**Note: I do not have form tags on the user controls

Default is the form Id on the DesktopDefault.aspx page. _ctl0 is the name of the user control with the (server control ParmID) on the user control Default.ascx

** Note: The user controls doesn't have form tags.

I'm not getting any errors.

The popup box comes up with the choices (OK or Cancel) but after clicking (OK) the page just refreshes with no delete.

I will post a copy of the converted forum notes when its finish to this forum to share with all.

The PostMessage Javascript Function:

<code>
<!-- <script language="javascript">
    function InsertTag(tagcode)
    {
        document.forms['Default'].PostMessage.Message.value += tagcode;
    }
</script> -->

HOW DO I CONVERT THESE FUNCTIONS and what changes if any to the code must take place?

ASP.Net doesn't have much info on accessing DOM objects in script. All help is appreciated
 
Old July 11th, 2003, 12:27 PM
Authorized User
 
Join Date: Jun 2003
Location: New orleans, Louisiana, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Success at last. I was able to get the Insert Tag Function to work as follows:

Old Code: for ASPX pages

<script language="javascript">
    function InsertTag(tagcode)
    {
        document.PostMessage.Message.value += tagcode;
    }
</script>

New Code: for ASCX pages

<script language="javascript">
    function InsertTag(tagcode)
    {
        document.forms["PostMessage"].elements["_ctl0:Message"].value += tagcode;
    }
</script>

I also packaged the functions in a file called /scripts/client.js

and placed it at the end of the end </html> in DesktopDefault.aspx.

I'm still working on the DeleteForum function. I suspect that its not the script since the insertTag Fuction is working.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variable from .aspx to .ascx.vb mister_mister ASP.NET 2.0 Basics 13 March 26th, 2008 11:31 AM
How can I creat a forum like P2P Forum? pcassiano ASP.NET 1.0 and 1.1 Basics 1 October 31st, 2005 05:00 AM
Which Forum? fishypew SQL Server 2000 1 May 12th, 2005 09:52 AM
Welcome to the forum! nzakas BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 May 6th, 2005 02:52 PM





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