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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:47:02+00:00 2026-05-23T17:47:02+00:00

I am writing a javascript function ValueChanges() { Parent = document.getElementById(‘<%= grvMultiChoiceAnswerList.ClientID %>’); var

  • 0

I am writing a javascript

function ValueChanges() 

  {

    Parent = document.getElementById('<%= grvMultiChoiceAnswerList.ClientID %>');
    var items = Parent.getElementsByTagName('textarea');
    var chkboxControl = Parent.getElementsByTagName('checkbox');

    for (i = 0; i < items.length; i++) {
        var hdnTextControl, hdnExplanation;
        hdnTextControl = (items[i].id).replace("txtText", "hdnText");
        hdnExplanation = (items[i].id).replace("txtExplanation", "hdnExplanation");

        if (items[i].id.split("_")[5] == "txtText") {
            if (items[i].value != document.getElementById(hdnTextControl).value) {
                var ssave = window.confirm('Your changes are not saved. Do you want to save your changes before you exit.')
                if (ssave == true) {
                    document.getElementById('<%=btnUpdate.ClientID%>').click(); // I WANT TO REPLACE THIS LIKE SO MY DELEGATE GETS FIRE
                    return false;
                }
                else
                    return true;
            }
        }
    }

I have a delegate

  grvMultiChoiceAnswerList.RowUpdating += delegate(object obj, GridViewUpdateEventArgs args)

{
            SaveFields();
            if (ReloadContent != null)
                ReloadContent(null, EventArgs.Empty);

        };

Now i want to call this delegate in my java script and want to replace document.getElementById(‘<%=btnUpdate.ClientID%>’).click(); line so my delegate get fire when if(ssave==ture) condition is true

  • 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-23T17:47:03+00:00Added an answer on May 23, 2026 at 5:47 pm

    In order to access to “methods” on the server from the javascript you need to make a postback with your javascript like :

    __doPostBack('MyBtn','');
    

    As far as the server goes , this will act the same as

    document.getElementById('<%=btnUpdate.ClientID%>').click(); 
    

    , but as for the client, it will skip any javascript linked with the click on the button.

    To access server side, you need to simulate the firing of an event from your javascript so that the asp.net page can recognise it and cling to it. Add the update column of the grid view and look at the javascript generated, it will give you the clue to know what to trigger within the dopostback. After you might need to keep the column but be able to hide it using css.

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

Sidebar

Related Questions

I am writing a JavaScript function to highlight the row and column of a
I'm writing a Javascript function that would manipulate an array written on-the-fly and sent
I'm writing some Javascript code that generates an XML document in the client (via
I'm writing javascript code for a web emulator containing function keys. The user is
1) How to programatically (without writing the onclick=javascript:.. attribute) attach JavaScript (jQuery) function to
The following ways of writing a javascript function are equivalent. Maybe the first one
I have a javascript function I'm writing which is being used to include an
When writing a Javascript a function that I had gotten help from earlier ,
I'm writing a JavaScript function that needs to uphold three properties: be very small
I'm writing a javascript function that has a pretty long list of parameters: FormatGrid(ID,

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.