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 4328872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:44:46+00:00 2026-05-21T09:44:46+00:00

I have a sublayout in sitecore (which is an ascx control) which contains a

  • 0

I have a sublayout in sitecore (which is an ascx control) which contains a hidden field and an image map. Depending on the area of the image map which is clicked, I want to set the value of the hidden field, then initiate a postback to the server.

My markup is as follows:

<script type="text/javascript">
function SetRegion(regionName) {
    $('#<%=hdnRegion.ClientID%>').val(regionName);
    __doPostBack('<%=lnkRedirectButton.UniqueID%>', '');
}
</script>

<img src="/Images/Interface/Map-Background.png" usemap="#regionMapView" class="map" />
<map id="regionMapView" name="regionMapView">
    <area id="x" href="javascript:SetRegion('x')" shape="poly" coords=",,,," />
    <area id="y" href="javascript:SetRegion('y')" shape="poly" coords=",,,," />
    <area id="z" href="javascript:SetRegion('z')" shape="poly" coords=",,,," />
</map>

<asp:HiddenField ID="hdnRegion" runat="server" />
<asp:LinkButton ID="lnkRedirectButton" onclick="lnkRedirectButton_Click" runat="server" />

and my code-behind is as follows:

    protected void lnkRedirectButton_Click(object sender, EventArgs e)
    {
        string region = hdnRegion.Value; //at this point, I expect hdnRegion.Value to be "x" "y" or "z" but it's always coming back empty :-(
        //do stuff...
    }

I added the dummy LinkButton to use as a hook for the postback (to create a code-behind method to handle the postback).

I’ve tried this code in a stand-alone webapplication and it seems to work fine, so I’m wondering if there is something going on with sitecore which is messing up the hidden field’s value during the postback process?

To clarify; the postback event is being fired and handled on the server ok and I’ve used alert() in javascript to confirm that the hidden field value was being set correctly.

Edit:
Retagged question to include jquery-ui tag.
This issue seems to be related to the fact that all of this is happening inside of a div which is displayed using $().dialog() method in the jQuery UI library…

  • 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-21T09:44:47+00:00Added an answer on May 21, 2026 at 9:44 am

    As mentioned in my edit, this issue is related to the fact that the hidden field (and everything else) is inside a div which is manipulated using the jQuery UI dialog method to create a popup window.

    I found this question (HiddenField value modified by javascript is not posted back)
    which gave me the answer and involves adding a single line of code to the open: callback in the dialog methods constructor.

    My JavaScript code for opening the dialog was modified as follows:

    $('#MyDialog').dialog({
        closeOnEscape: true,
        open: function(event, ui) {
            $(this).parent().appendTo("form"); //this line sorted everything!
        }
    }); 
    

    To quote DanaBenson “I believe the root cause is that jQueryUI attaches dialogs to the BODY tag not the FORM tag, where .Net needs it to be.”

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

Sidebar

Related Questions

In Sitecore 6, I have created a sublayout that has an asp:login control. For
I have a sublayout in my Sitecore site which is used to perform a
I have a custom user control loaded into a sublayout in Sitecore. When I
I want to access (and then modify) the properties for the image field (s)
I have a LinearLayout that contains sublayouts which essentially mimick a 3x2 grid. Each
Essentially what I want to do is have a root application.haml that contains the
I have two buttons in a horizontal field manager. one i want to put
I'm using one Sublayout (Sitecore) and have a placeHolder that currently holds 2 webcontrols.
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a template A which has several sublayouts and web controls assigned to

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.