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

  • SEARCH
  • Home
  • 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 1107575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:57:27+00:00 2026-05-17T01:57:27+00:00

I’m working on a commenting system for a website and on each postback a

  • 0

I’m working on a commenting system for a website and on each postback a page generates a user control (called ucComment) for every single comment in the database that pertains to this page. Each ucComment has a Respond button that allows you to respond to each individual comment.

I was having a problem with the Respond button not doing anything when I finally realized that every time a new comment was created, the next postback it would offset all the page’s control IDs. In other words, when I click on ctl00_Content_ctl00_ctl01_ctl07_lbtnRespond, that control would actually be generated as ctl00_Content_ctl00_ctl01_ctl08_lbtnRespond on the next postback. So the event associated with ctl07 would simply not happen.

While poking around on the web, I read about overriding the ClientID. I thought if I could name the controls the way I wanted to, I could circumvent my problem.
http://west-wind.com/Weblog/posts/4605.aspx
It looked like a great hack but it doesn’t fire events because of the disparity between the generated ID on the page and how the ID was represented in the control tree.

there’s even a guy who derived from MasterPage to change the way that the control tree works to get the above hack to work for postbacks:
http://www.netquarry.com/index.php/2009/03/master-pages-ajax-and-javascript-10292/
but i fear that there may be untold repercussions.

What should I do to get my commenting system working such that I can respond to a specific comment and have the respond event still fire even if the control is renamed on that postback?

  • 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-17T01:57:28+00:00Added an answer on May 17, 2026 at 1:57 am

    I’m the guy at NetQuarry that worked up the MasterPage-derived class.

    I don’t know if you’ve solved your problem or not. I can certainly understand your concern about my MasterPage approach. I was concerned that it might be fragile as well. However, it’s been working well now for about a year and half on about half a dozen different web applications that are built on our platform. That said, since they’re all built on our platform, they do have certain similarities. The code also continued to work without issue when we moved from .Net 2.0 to .Net 3.5.

    Recently however, we did find a that the approach does not work with UpdatePanels and have not been able to remedy the situation. While researching that problem I discovered that .Net 4.0 provides much better control over ClientID’s than .Net 3.5 and I suspect that with 3.5 it will be pretty simple to fix this kind of thing. Here’s a good article from Scott Guthrie about this:

    http://weblogs.asp.net/scottgu/archive/2010/03/30/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series.aspx

    Edit: It just occurred to me that in this case your problem might be solved by simply rendering each comment respond button with a unique ID based on the primary key of the related comment record. That way on a postback the ID of each existing button never changes.

    Hope this is helpful.

    Cam

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.