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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:02:49+00:00 2026-05-27T07:02:49+00:00

I want to show the value of the variable in Alert box so please

  • 0

I want to show the value of the variable in Alert box so please give me suggestion for that. Here is my code.

public partial class WebForm1 : System.Web.UI.Page
     {
        int sum3; 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { 
                DataTable dTable = new DataTable("mainTable");
                 DataColumn Name = new DataColumn("Name");
                dTable.Columns.Add(Name);
                 DataColumn Marks = new DataColumn("Marks");
                dTable.Columns.Add(Marks); 
                DataColumn Marks2 = new DataColumn("Marks2");
                dTable.Columns.Add(Marks2); 
                DataColumn Total = new DataColumn("Total");
                dTable.Columns.Add(Total); 
                int sum = 0;
                int sum2 = 0; 
                DataRow dRow = null;
                for (int i = 0; i < 5; i++)
                {
                    dRow = dTable.NewRow();
                    dRow["Name"] = i + " - Sagar";
                    dRow["Marks"] = i;
                    sum += i;
                    dRow["Marks2"] = i + 5;
                    sum2 += i + 5;
                    dRow["Total"] = i + i + 5;
                    sum3 += i + i + 5;
                    dTable.Rows.Add(dRow);
                }
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert(" + sum3.ToString() + ");", true);

                       aspDataGrid.DataSource = dTable;
                aspDataGrid.DataBind();
            }
        }

        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            marks1.Text = "Total Marks : " + sum3.ToString();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert(" + sum3.ToString() + ");", true);
        }
}

Thanks in advance.

  • 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-27T07:02:49+00:00Added an answer on May 27, 2026 at 7:02 am

    You can try This Using Session Like…

    In Your Page_Load Event write
    Session[“sum3”]=sum3 After For Loop And Then You Can write This Code in
    Button Submit Button

    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert(" + Session["sum3"] + ");", true);

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

Sidebar

Related Questions

I want to show on the screen some value, that are changeable. I have
I'm trying to give a global variable a value after some code is processed.
I want to show tooltip in cgridview value as on hover on column it
So I want a field in my table to show the value from the
When grouping in BIRT, we frequently want the grouping value to show up on
hii I want show a pop up Dialog box when i click on to
How can I alert an integer value in flex. I have a variable called
I want to make a php ajax post.(post value without refresh the page) here
I want to make a php ajax post.(post value without refresh the page) here
I do scientific programming, and often want to show users prompts and variable pairs,

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.