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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:01:22+00:00 2026-06-01T11:01:22+00:00

I have an asp.net page. There is a button Edit on the bottom that

  • 0

I have an asp.net page. There is a button “Edit” on the bottom that is invisible by default. By clicking a button on the left side bar, it is supposed to be shown.
But it is not working, help needed.
Thanks.
Code:

<div id="wrap">
      <div id="header">
    </div>
     <div id="nav">
        <asp:Button ID="Lookup" runat="server" Text="Lookup" CssClass="nav_buttons" ClientIDMode="Static"/>
        <asp:Button ID="Metric" runat="server" Text="Metric" CssClass="nav_buttons" />
    </div>
    <div id="sidebar">
        <asp:Button ID="Button1" runat="server" Text="Button1" ClientIDMode="Static" CssClass="sidebar_buttons"
            OnClick="Button1_Click" />
        <asp:Button ID="Button2" runat="server" Text="Button2" CssClass="sidebar_buttons" />
    </div>
     <div id="sameheight">
        <div id="gridview">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                DataSourceID="SqlDataSource1" AutoGenerateEditButton="True" AutoGenerateSelectButton="True" />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="SELECT * FROM [t1]"></asp:SqlDataSource>
        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="sKey" DataSourceID="SqlDataSource2" />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="SELECT * FROM [t2]"></asp:SqlDataSource>
        </div>
        <div id="btnEdit">
            <asp:Button ID="Edit" runat="server" ClientIDMode="Static" Text="Edit" OnClientClick="javascript:Edit_Click();return false;" />
        </div>
    </div>
    <script>
        $(document).ready(function () {
            var divone = $("#sidebar").height();
            var divtwo = $("#gridview").height();
            var maxdiv = Math.max(divone, divtwo);
            $("#sidebar").height(maxdiv);
            $("#gridview").height(maxdiv);
        });
         $("#Button1").click(function (event) {
            $("#Edit").show();
        }); 
    </script>
</div>

CSS:

#wrap
{
width: 800px;
background-color: #99c;
overflow: hidden;
}
#header
{
border-style: solid;
border-width: 1px;
background-color: #ddd;
width: 800px;
padding-top: 30px;
padding-bottom: 30px;
}
#sidebar
{
float: left;
width: 125px;
padding-top: 10px;
background-color: #C0C0C0;
}
#nav
{
background-color: #c99;
padding-top: 30px;
padding-bottom: 30px;
width: 800px;
border-style: solid;
border-width: 1px;
}

.sidebar_buttons
{
margin-top: 10px;
margin-left: 2px;
width: 120px;
}

#gridview
{
float: right;
width: 675px;
}

#Edit
{
float: left;
display: none;

}


#sameheight
{
 float: right;
 }

Code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebTest
{
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GridView1.Visible = false;
        GridView2.Visible = false;
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
         GridView1.DataBind();
         GridView1.Visible = true;

         GridView2.DataSource = null;
         GridView2.Visible = false;
    }
}

}
Image layout:
Layout

  • 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-01T11:01:23+00:00Added an answer on June 1, 2026 at 11:01 am

    Need to reference the ClientID of Button1 to make it accessible in the JavaScript

    $("#Button1").click(function (event) { 
    

    Would be

    $('#<%= Button1.ClientID %>').click(function (event) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET page with an asp:button that is not visible. I can't
I have a usercontrol that is in an asp.net page that contains a button.
I have a button on my asp.net page that (upon mouseover) needs to act
I have grid in my ASP.NET page (actualy it's Telerik RadGrid). There is GridButtonColumn
I have an ASP.Net page that will be hosted on a couple different servers,
I have an ASP.NET page with a jQuery dialog that is displayed to change
I have three button INSERT,EDIT and DELETE on sample.aspx page in .net application.I am
I have an asp.net page (C# codebehind), and in page_load there are various linq
I have a asp.net page content as below. There is an HtmlInputText control inside
I have an ASP.NET 4.0 page that I'm trying to reset to the top

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.