Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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



All times are GMT -4. The time now is 09:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.