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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:29+00:00 2026-05-24T21:27:29+00:00

The following sets my stage vb.net MasterPages Usercontrol with defined events This is what

  • 0

The following sets my stage

  • vb.net
  • MasterPages
  • Usercontrol with defined events

This is what my usercontrol looks like:

enter image description here

When the user clicks the ‘Approve’ button, an event is fired in the usercontrol that is then intercepted in the main page to do custom code (database update, mails etc…)

This is the code (in usercontrol)-works perfectly

Protected Sub approvedcsiclicked()
RaiseEvent DCSIdecisionEvent(1)
dcsimanagerstatus = 1
showhidedcsibuttons(False)
dcsidate = String.Format(System.DateTime.Today.Date, "dd-MMM-YYYY")
dcsidatelbl.Visible = True
End Sub

When the user is clicking the ‘Deny’ button, i’ld like to offer the user the possibilty to enter some feedback as to why it’s denied.

I was hoping to use Colorbox plugin for that.

This is what i’ve got under the deny button click.. –This works too , my Colorbox is getting fired.

Protected Sub denydcsiclicked()
    Page.ClientScript.RegisterStartupScript(Me.GetType, "showerror", "showdenialdcsi();", True)
    dcsimanagerstatus = 2
    showhidedcsibuttons(False)
    dcsidate = String.Format(System.DateTime.Today.Date, "dd-MMM-YYYY")
    dcsidatelbl.Visible = True
End Sub

enter image description here

The Questions remains: How do i get the input data back into my form so i can save and process it before the customEvent is being raised.
The CustomEvent is raised after the user clicked OK in the Colorbox plugin- see code at at bottom- it carries out a ‘click’ on a hidden button.

  Protected Sub Hiddenbutton_Click(sender As Object, e As System.EventArgs) Handles Hiddenbutton.Click
    'this hidden button click is to raise the event of the dcsi denial
    'we can not do it normally as we need to capture first the denyreason and then raise the event
    DcsiDenyreason = denialreasonlbl.Text
    RaiseEvent DCSIdecisionEvent(2)
End Sub

When i do a debugging, i can see my mainpage and usercontrol both being loaded and unloaded

Usercontrol init: 11/08/2011 21:06:56
main Page Load : 11/08/2011 21:06:56
Main page postback : 11/08/2011 21:06:58
Usercontrol postback: 11/08/2011 21:06:58
Usercontrol unLoad : 11/08/2011 21:06:58
Main page unload : 11/08/2011 21:06:58

at the time the Colorbox /Jquery popup is showing.

I can key in data but how do i save it, so when the customevent is fired, i still know what was keyed in?

This is my popup script in codebehind.

If Not (cs.IsClientScriptBlockRegistered(clientscripttype, clientscriptname)) Then
        Dim myscript As New StringBuilder
        myscript.Append("<script type='text/javascript'> ")
        myscript.AppendLine("function showdenialdcsi()  ")
        myscript.AppendLine("{  ")
        myscript.AppendLine(" $(document).ready(function() ")
        myscript.AppendLine("                              {  ")
        myscript.AppendLine("                              $.colorbox({width:'50%' , inline: true, escKey:false, overlayClose:false, href: '#Denialreason', onLoad: function ()")
        myscript.AppendLine("                                                {")
        myscript.AppendLine("                                                $('#cboxClose').remove();")
        myscript.AppendLine("                                                }")
        myscript.AppendLine("                                         });")
        myscript.AppendLine("                               $('[id$=titleOK]').live('click', function (e) ")
        myscript.AppendLine("                                   {")
        myscript.AppendLine("                                   javascript: raisevent(); ")
        myscript.AppendLine("                                   $.fn.colorbox.close();")
        myscript.AppendLine("                                   });")
        myscript.AppendLine(" ")
        myscript.AppendLine(" function raisevent() ")
        myscript.AppendLine(" { ")
        myscript.AppendLine("   var o=document.getElementById('unchangedHidden').getAttribute('value');")
        myscript.AppendLine("   document.getElementById(o).click(); ")
        myscript.AppendLine(" } ")
        myscript.AppendLine("                               }")
        myscript.AppendLine("                   );")
        myscript.AppendLine("}  ")
        myscript.Append(" </script> ")
        cs.RegisterClientScriptBlock(clientscripttype, clientscriptname, myscript.ToString, False)
    End If

This is the html for the colorbox

<div style='display: none'>
    <div id='Denialreason' style='padding: 10px; background: #fff;'>
        <h3>
            <font color="red"><strong>Denial Reason ? :</strong></font>
        </h3>
        <p style="font-size: larger">
                        Please enter the reason. This will go back to the user. <br /> 
                        <asp:textbox ID="denialreasontxt" runat="server" Font-Bold ="true"  TextMode="MultiLine" Rows="4" Columns="50"></asp:textbox>         <br />
        </p>
        <br />
        <div class="Center_300">
            <asp:Label ID="titleOK" runat="server" CssClass="OverviewLabelGray" Width="200"><span>OK</span></asp:Label>
        </div>
    </div>
 </div>
 <a href="#" class="Denialclass" id="urlnotassigned" runat="server"></a> 

<input type="hidden" id="unchangedHidden" value="<%=Hiddenbutton.ClientID%>" />
<asp:Button ID="Hiddenbutton" runat="server" Text="" />
  • 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-24T21:27:30+00:00Added an answer on May 24, 2026 at 9:27 pm

    This is how i fixed it after some trials and errors.

    a) popup script in Code Behind changed to

    If Not (cs.IsClientScriptBlockRegistered(clientscripttype, clientscriptname)) Then
            Dim myscript As New StringBuilder
            myscript.Append("<script type='text/javascript'> ")
            myscript.AppendLine("function showdenialdcsi()  ")
            myscript.AppendLine("{  ")
            myscript.AppendLine(" $(document).ready(function() ")
            myscript.AppendLine("                              {  ")
            myscript.AppendLine("                              $.colorbox({width:'50%' , inline: true, escKey:false, overlayClose:false, href: '#Denialreason', onLoad: function ()")
            myscript.AppendLine("                                                {")
            myscript.AppendLine("                                                $('#cboxClose').remove();")
            myscript.AppendLine("                                                }")
            myscript.AppendLine("                                         });")
            myscript.AppendLine("                               $('[id$=titleOK]').live('click', function (e) ")
            myscript.AppendLine("                                   {")
            myscript.AppendLine("                                   var a= $('[id$=denialreasonlbl]');")
            myscript.AppendLine("                                   var b= $('[id$=denialreasontxt]');")
            myscript.AppendLine("                                   a.val(b.val().substring(0,150)) ; ")
            myscript.AppendLine("                                   javascript: raisevent(); ")
            myscript.AppendLine("                                   $.fn.colorbox.close();")
            myscript.AppendLine("                                   });")
            myscript.AppendLine(" ")
            myscript.AppendLine(" function raisevent() ")
            myscript.AppendLine(" { ")
            myscript.AppendLine("   var o=document.getElementById('unchangedHidden').getAttribute('value');")
            myscript.AppendLine("   document.getElementById(o).click(); ")
            myscript.AppendLine(" } ")
            myscript.AppendLine("                               }")
            myscript.AppendLine("                   );")
            myscript.AppendLine("}  ")
            myscript.Append(" </script> ")
            cs.RegisterClientScriptBlock(clientscripttype, clientscriptname, myscript.ToString, False)
        End If
    

    b) the Deny button click changed to

    Protected Sub denydcsiclicked()
      Page.ClientScript.RegisterStartupScript(Me.GetType, "showerror", "showdenialdcsi();", True)
    End Sub
    

    c) the (hidden) javascript click event changed to

    Protected Sub Hiddenbutton_Click(sender As Object, e As System.EventArgs) Handles Hiddenbutton.Click
        'this hidden button click is to raise the event of the dcsi denial
        'we can not do it normally as we need to capture first the denyreason and then raise the event
        dcsimanagerstatus = 2
        managerstatus = -1
        showhidedcsibuttons(False)
        showhidemanagerbuttons(False)
        dcsidate = String.Format(System.DateTime.Today.Date, "dd-MMM-YYYY")
        dcsidatelbl.Visible = True
        RaiseEvent DCSIdecisionEvent(2)
    End Sub
    

    Bascially, when pressing the ‘OK’ button in the Colorobx popup I’m searching in the DOM for 2 Id’s.

    The Denialreasontxt is a textbox that is in the Colorbox popup. This is where i’ve typed in the reason.
    The Denialreasonlbl is a label in the mainpage where i want to copy the Colorbox’s values in (trimmed to 150 char).
    Since the postback already happened, Jquery is able to find these objects.

    The trick was to specify the denialreasonlbl as a hidden Field, so that the value it got is surviving the postback.

    so, in my usercontrol, i’ve added

    <input type="hidden" id="denialreasonlbl" runat="server" />
    

    And then, when i do the RaiseEvent DcsidecisionEvent(2), it causes a postback.
    In the mainpage, i check on postback if this label contains any value or not.

                If Not IsDBNull(reader.Item("dcsidenialreason")) Then
                    Approvalpanel.dcsidenyreason = reader.Item("dcsidenialreason")
                    Approvalpanel.showdenialdreason()
                Else
                    'check if dcsimanager did a denial and the reasontxt is in the postback page
                    If Not Approvalpanel.dcsidenyreason = String.Empty Then
                        Approvalpanel.showdenialdreason()
                    End If
                End If
    

    Bingo !

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

Sidebar

Related Questions

Following up to this question , it seems like Select-Object sets its input to
I have the following code that sets a background if user has uploaded to
I want to do the following: The user sets 3 parameters in MVC3 view:
Following Ryan Bates' instructions on creating a before_filter that sets a time_zone like so
I have created an activity that refresh quotes when the user clicks a button.
I have the following function which sets up the GUI. public void go() {
Following are two pieces of code I used to compute power sets of elements
I have tried the following MySQL update but it only sets the first field
Executing the following sql: USE [WSS_Content] EXEC sp_helplogins returns two result sets, and within
I have a table with sets of settings for users, it has the following

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.