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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:37:34+00:00 2026-06-17T06:37:34+00:00

I have a grid view that I want to use with JavaScript to calculate

  • 0

I have a grid view that I want to use with JavaScript to calculate values entered in the textboxes.

I was adding onkeyup to the textboxes in the onrowcreated function and it was working fine.

Then I put the gridview in a multiview, and it stopped working.

This is my JavaScript function:

   function margin1(rowIndex, price, gridId) {
        var grid = document.getElementById(gridId);
        var volumeQuota = grid.rows[rowIndex].cells[2].innerText;
        alert(volumeQuota);
        var coef = grid.rows[rowIndex].cells[5].childNodes.item(1).value;
        alert(coef);
        var prevSites = grid.rows[rowIndex].cells[4].innerText;;
        grid.rows[rowIndex].cells[6].childNodes.item(1).value = parseFloat(coef) * (parseFloat(volumeQuota) - parseFloat(prevSites));
        grid.rows[rowIndex].cells[7].childNodes.item(1).value = price;

    }

and in the code behind this is how im adding it.

         if (e.Row.RowType == DataControlRowType.DataRow)
        {
            TextBox t1 = (TextBox)e.Row.FindControl("p98Margin1");
            t1.Attributes.Add("onkeyup",
                 string.Format("javascript:margin1('{0}', {1}, {2})", e.Row.RowIndex + 2,       a98.Text , GridView1.ClientID));

when I alert Gridview1.clientId in the JavaScript function I’m getting [objectHTMLTableElement]

  • 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-06-17T06:37:35+00:00Added an answer on June 17, 2026 at 6:37 am

    use this

       t1.Attributes.Add("onkeyup",
                 string.Format("javascript:margin1('{0}', '{1}', '{2})'", e.Row.RowIndex + 2,       a98.Text , GridView1.ClientID));
    

    I think this should work.
    I think the value should go in single quotes ' mark.

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

Sidebar

Related Questions

I'm using .NET webforms. I have a grid view that can use Eval(Name) in
I have a grid view which uses SQL to calculate information that I need!
I have a grid view that has two simple columns, a report number and
I have used a list view that uses a grid view in WPF. I
I have a View that is basically setup like this: <Grid> <ViewBox> <Grid> <ItemsControl
I have a partial view that uses a Telerik MVC Grid, and it has
I currently have a product view page that contains an MVCContrib HTML Grid with
I have a view designed like that: Ext.define('MY.view.NotificationMails', { extend: 'Ext.grid.Panel', alias: 'widget.NotificationMailsPanel', id:
I have a grid view ,i use the row command to open a specific
I have a page that can be viewed by list or grid view through

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.