ASP.NET - Hide Gridview

Asked By Rahul
10-Feb-12 01:01 AM
How to hide gridview1 and how to display gridview2,

hide gridview1 and set visible true for Gridview2
  Somesh Yadav replied to Rahul
10-Feb-12 01:18 AM

well it depends on what you are doing inside RunIt(); method

if you are updating a datasource binded to gridview then you can try this after RunIt();

GridView1.Visible = true;

Gridview1.DataBind();

or this(in case datasource is not binded to gridview already)

GridView1.Visible = true;

Gridview1.DataSource = dataSourceObject;         // replace dataSourceObject with your datasource Object

Gridview1.DataBind();

  Web Star replied to Rahul
10-Feb-12 01:42 AM
Hi maddy
I don't understand why you are asking such type of query which already you know that hide and show controls by setting visible property false or true on you page. that is simple thing and if you don't know than also you should check these on your page itself than only you aware more and more.
  Sreekumar P replied to Rahul
10-Feb-12 01:52 AM
Hi,

You can simple use the

GridView1.Visible = true; ///set false to hide.

This is for server side.

If from Javsscript (Client side)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
 
 
  <script type="text/javascript">
     
    function hideGridView() {
      document.getElementById('<%=GridView1.ClientID %>').style.display = "none";
    }
    function showGridView() {
        document.getElementById('<%=GridView1.ClientID %>').style.display = "";
    }
  </script>
 
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <asp:GridView ID="GridView1" runat="server">
    </asp:GridView>
      
    <a href="javascript:hideGridView()">Hide</a>
    <a href="javascript:showGridView()">Hide</a>
  </div>
  </form>
</body>
</html>
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B fundamental of published or precreated objects in Remoting? (A) What are the ways in which client can create object on server in CAO model? (A) Are CAO stateful in nature? (A be done? (I) Is it a good design practice to distribute the implementation to Remoting Client? (A) What are LeaseTime, SponsorshipTime, RenewonCallTime and LeaseManagerPollTime? (A) Which config file has all the A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET
ds1.Tables.Add(”employee”); sqlDa1.Fill(ds1, 40, 50, ds1.Tables[”employee”].TableName); DataGrid dg1.DataSource = ds1.Tables[”employee”].DefaultView; dg1.DataBind(); Answer2 OleDbConnection1.Open() OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”) This will fill the dataset with SqlParameter(”@percentage”, SqlDbType.Int); sqlCom1.Parameters.Add (myPar); myPar.Value = 40; sqlDa1.Fill(ds1); dg1.DataSource = ds1; dg1.DataBind(); Answer2 Yes Dim cn as new OleDbConnection ( “Provider = Microsoft.Jet.OLEDB.4.0;”+ _ “Data da As New OleDataAdapter(cmd) Dim ds As New DataSet() da.Fill(ds, “Products”) DataGrid1.DataSource = ds.Tables(”Products”) What is the maximum length of a varchar in SQL Server? Answer1 in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't
session is user based mean u can differentiate login user in different way • Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host process. If session state is in a separate process, the ASP.NET process can come and go while the session state process remains available. Of course, you ASP, too. • Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves the server farm problem. The new out-of-process model allows all servers