Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6128445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:37:40+00:00 2026-05-23T16:37:40+00:00

I have a folder structure tree i want to reuse on several pages i

  • 0

I have a folder structure tree i want to reuse on several pages i am building a user control (webForms) for this with a small jquery that gets the html to display from a httphandler. so far so good. I want the user to be able to click a link on a folder i the HTMl i return from my http handler, but it seems that my page is not able to connect the jquery on the page with the jquery returned from the http handler. In my ascx file i have the event handlers for the folder links, and the links are generated in my http handler.

public void ProcessRequest(HttpContext context)
        {
            List<MultimediaType> types = typeRepository.LoadAll(); //load all the types for displaying in the list
            types.ForEach(x =>
                {
                    multimediaTypes.Add(x.Id, x.Name);
                });
            int folderId = string.IsNullOrEmpty(context.Request["folderid"]) ? 0 : int.Parse(context.Request["folderid"]);
            //load folders, from query string, if no folderid in querystring, then default to root
            List<MultimediaFolder> folders = repository.LoadAll(folderId);


            //load files
            List<Multimedia> files = fileRepository.LoadAll(folderId);
            string folderData = BuildFolderList(folders);
            string fileData = BuildFileList(files);
            context.Response.ContentType = "text/html";
            context.Response.Write("<b>" + DateTime.Now.ToString() + "</b>");
            context.Response.Write("<script type='text/javascript'>");            
            context.Response.Write("$('.folderlink').click(function () {");
            //context.Response.Write("$.get('FolderStructureHandler.ashx', function (data) {");
            context.Response.Write("alert('test');");
            context.Response.Write("});");
            context.Response.Write("});");
            context.Response.Write("</script>");

            context.Response.Write("<table border='1'>");
            context.Response.Write("<th><td>Name</td><td>Type</td></th>");
            context.Response.Write(folderData);
            context.Response.Write(fileData);
            context.Response.Write("</table>");
        }

and the code for my user control is quite simple:

<script type="text/javascript">
    $(document).ready(function () {
        $.get("FolderStructureHandler.ashx", function (data) {
            $("#folderList").html(data);
        });
    });
</script>
<div id="folderList"></div>

Both of the methods to write the html is simple:

private string BuildFolderList(List<MultimediaFolder> folders)
        {
            StringBuilder builder = new StringBuilder();
            foreach (MultimediaFolder folder in folders)
            {
                builder.AppendFormat("<tr><td width='20'><img src='../Images/folder.png'/></td><td colspan='2'><a href='#' class='folderlink'>{0}</a></td></tr>", folder.Name);
            }
            return builder.ToString();
        }

I have tried to have the jquery .click() eventhandler in the .ascx markup also, but with no success, now i tried to send it with the html from the http handler, still no success. Does anyone have a possible solution to this problem.

Im getting the data loaded on the first time and sees my html table, but when i click a link nothing happens…

Sincerely,

Edit
Minor modifications to the generated JQuery from the HTTPHandler, it now makes an alert (i had a syntax error), but now im calling the handler each time, but the date time does not seem to change…

new httphandler code:

//load files
            List<Multimedia> files = fileRepository.LoadAll(folderId);
            string folderData = BuildFolderList(folders);
            string fileData = BuildFileList(files);
            context.Response.ContentType = "text/html";
            context.Response.Write("<b>" + DateTime.Now.ToString() + "</b>");
            context.Response.Write("<script type='text/javascript'>");            
            context.Response.Write("$('.folderlink').click(function () {");
            context.Response.Write("$.get('FolderStructureHandler.ashx', function (data) {");
            context.Response.Write("alert(data);");
            context.Response.Write("});");
            context.Response.Write("});");
            context.Response.Write("</script>");

            context.Response.Write("<table border='1'>");
            context.Response.Write("<th><td>Name</td><td>Type</td></th>");
            context.Response.Write(folderData);
            context.Response.Write(fileData);
            context.Response.Write("</table>");

This creates a popup with the table in, but the date is always the same, as though it is cached or something.???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:37:41+00:00Added an answer on May 23, 2026 at 4:37 pm

    It sounds like your elements are being written after the event handler is assigned. Try using

    .live("click", function)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a files structure like this: Class (folder): - User.php - Rule.php Scripts
I have a directory tree structure. Each time I click a folder, jQuery.ajax fires
I have a folder structure like this: /some_folder /tmp /tmp/foo /tmp/foo/fu * /tmp/bar /tmp/bar/bah
I have a folder structure like this: /articles .index.php .second.php .third.php .fourth.php If I'm
If I have a folder structure that looks like this: / /bin/myComponent.cfc /reports/index.cfm How
My folder structure is like - root admin create_page.php pages my_page1.php my_page2.php I have
I have a custom checkbox node tree . The structure is like this .
I have a folder structure like this: package_name/ |-- module1 |-- module2 |-- module3
I would like to have a tree/ folder structure for my content but would
I have this tree displaying the file structure, I have folders and files. Some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.