.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

programmatically hide the Gridview selectbutton

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net


I want to hide the select button in my grid view programmaticlly in the form startup.

any suggestions how to do this?



View Complete Post

More Related Resource Links

Programmatically Hide Master Pages from Site Master Page Settings page?



I know there is a field you can check when you edit the properties of a Master Page in the Master Page Gallery to set a Master Page to hidden but ... can anyone think of a way to programmatically hide specific Master Pages from the Site Master Page Settings page?

Maybe this should be two questions:

  1. How do I programmatically access a Master Page in a Master Page Gallery?
  2. Is there a property that can be set that will hide the page from the Site Master Page Settings page?

How to programmatically hide SSRS reports

I've built a process to deploy several reports to SSRS in either native mode or SharePoint integrated mode.  I'd like to programmatically hide several SSRS reports when deploying them to a sharepoint site.  I believe I need to do something like this -  http://www.mssqltips.com/tip.asp?tip=1357.  Any pointers?  I'm new to SharePoint development. Thx.

have print friendly page, want to hide columns of gridview

using vb.net/asp.net 2005I have linkbuttons calling the javascript function at the bottom of this post to print out the contents of a div and this is working ok but theissue that i have is inside the div is a gridview that displays links and another text column (among other colums) and I would like tohide the links and the text column next to it using css.Has anyone done this?btw, here is the javascript print function# function printThisDiv() # { # try{ # var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; # sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; # # var sWinHTML = document.getElementById('dvTheDivIWantToPrint').innerHTML; # # # var winprint=window.open("","",sOption); # winprint.document.open(); # winprint.document.write('<html><body>'); # winprint.document.write(sWinHTML); # winprint.document.write('</body></html>'); # winprint.document.close(); # winprint.focus(); # # }catch(err){ # txt="There was an error on this page.\n\n"; # txt+="Error description: " + err.description + "\n\n"; # txt+="Click OK to continue.\n\n"; # alert(txt); # } }

hide gridview column using javascript. working in ie and firefox but In firefox, gridview data is sh


function EnableDisableGridViewColumn() {
               var AdvanceSearch = document.getElementById('<%= chkboxlist1.ClientID %>');
               var chkList = AdvanceSearch.getElementsByTagName("input");
               var dgTest = document.getElementById("gridview1")
               if (dgTest != null)
                   for (var i = 1; i < dgTest.rows.length; i++) {

                       if (chkList[0].checked == true && chkList[1].checked == true) {
                           dgTest.rows[0].cells[0].style.display = "block";

Help with programmatically set Edit, Update in Gridview


 I'm at the front end of allowing the user to update their data that requires nested gridviews.

I thought I had it set up correctly, but; once I have the grivdiew in Edit mode, when I move the cursor to the first row's textbox, the routine switched out of Edit mode (without a clicking on the Update). I would like to update the data on the screen before the program decides to update the db.

What's causing this?

Here's my aspx page as follows:

<%@ Page Language="VB" AutoEventWireup="false" EnableEventValidation="false" CodeFile="RONs_UPDATING.aspx.vb" Inherits="RONs_UPDATING" %>

<!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>Untitled Page</title>
    <form id="form1" runat="server">
    <div id="div_units" runat="server" style="font-size: medium">
        <asp:GridView ID="gv_x_Units" runat="server" AutoGenerateColumns="False" Style="z-index: 100; left: 110px; position: absolute; top: 10p

Help:JAVASCRIPT (checkAll) & (Hide/Unhide GridView1) in a Datalist with a nested Gridview


Hey guys,

 I'm at my wits end on this one looked/Searched/Played/Experimented and I need your help if you can.

This page is going to be primarily used on a mobile device using Win Mobile 5


Need to Accomplish:

  1. Prevent Postback(serverside) of Page using JavaScript (Postback's slow down the page on mobile device)


JavaScript Requests:

  1. Hide and UnHide the Nested Gridview1 by Clicking on a imagebutton1 in DataList1icon_minized_collapse.pngicon_expand_collapse.png
  2. CheckBox in DataList1 Checks All and UNChecks All, CheckBox in just the related Gridview1


Controls :

  1. Gridview1 nested inside DataList1


Note: Datalist1 and Gridview1 have datasource's in production. The Codebehind page is just appling test data to help me figure this out.


Thank you all in advance for helping me with this.

Example data below:<

Programmatically displaying an image in Gridview


Hi Guys,

I need your help!

I have a list of image names stored in a database, along with the id of the property they are associated with. I'd like to be able to display all of the images in a gridview and then allow the user to select the required image.

The problem I'm having is that the gridview is not displaying. I'm pretty sure it's something basic that I've missed, but can't for the life of me see what it is!

Any help would be greatly appreciated!


My gridview code in my aspx page:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">

My code behind (propId is the property id):

        query = "SELECT id, filepath "
                + "FROM images "
                + "WHERE id = ?id";

        MySql.Data.MySqlClient.MySqlCommand command = new MySql.Data.MySqlClient.MySqlCommand();
        command.CommandText = query;
        command.Connection = MyConn;
        command.Parameters.AddWithValue("?id", propId);

        MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter();
        da.SelectCommand = command;
        DataSet ds = new DataSe

How can i hide selected rows from gridview


Can u tell me how can i hide selected rows from girdview using javascript.

Show or hide programmatically based on audience


I'm trying to either show or hide a datalist control based on a users Audience.

      AudienceLoader audienceLoader = AudienceLoader.GetAudienceLoader();

      string audienceFieldValue = "United States";

      if ((AudienceManager.IsCurrentUserInAudienceOf(audienceLoader, audienceFieldValue, false)))
        DataList2.Visible = true;
        DataList2.Visible = false;

I have tried couple different things this is where I'm at now... any help would be appreciated.




how to hide a coloum in a gridview using jquey


how to hide a coloum in a gridview using jquey

  i have a table coloumn are


i require hide the coloum b2 how to do this

Need to hide gridview - not working


 I am trying to hide my Gridview when UpdateProgress control is being shown. Currently both the GridView and UpdateProgress contriols are being shown at same time. It works fine when I select from my DroDownList3 the 1st time (as no GridView is beings shown). On subsequent selections in the DroDownList3 control, both GridView3 and UpDateProgress control are shown.

<script type="text/javascript">
            function HideGridView2()
<cc1:TabContainer ID="TabContainer1" runat="server" Height="20px" ActiveTabIndex="0">
                    <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Current Shift" Style="font-size: xxx-small"
                            Current Shifts
                            <br />
                            <div style="height: 30px; left: 

best way to remove (or hide) a gridview column in a custom page


can someone tell what the best way to remove (or hide) a gridview column is within a custom page?

I dont want to show the link column that is automatically generated as a result of the relationship between the table in question and a parent table.



How do I programmatically iterate through different pages in a GridView?


OK I am a total novice to VB so bear with me.In my web-based project, I pass an ID field as a parameter in my URL and go through each row in my gridview to find the correct row that matches the ID parameter, like so: 

Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.DataBound
 REM if valid ID parameter was given in URL
 If Not Request.QueryString("ID") Is Nothing AndAlso _
  IsNumeric(Request.QueryString("ID")) Then
  Dim bItemNotFound As Boolean = True
  Dim i As Integer
  Dim iSelectedIndex As Integer = -1

  REM Loop through the items in the GridView
  For i = 0 To GridView1.DataKeys.Count - 1 Step i + 1

   REM Found the correct item
   If Request.QueryString("ID") = GridView1.DataKeys(i).Value Then
    bItemNotFound = False
    iSelectedIndex = i
    Exit For
   End If

  If bItemNotFound = False Then
   GridView1.SelectedIndex = iSelectedIndex
   GridView1.SelectedIndex = -1
  End If

 End If
End Sub

The problem is that this code only works if the corresponding ID is in a row displayed on the first page. I want to loop through each page in the gridview's rows until either the correct ID is found or it reaches the end of the data set. How do I

Hide coulmn from gridview



I am working on asp.net page where I need to hide some coulmn("Grid or Ptf") when user click checkbox. Below is code.

 <div class="divPanel2" style="height:450px; ">
            <asp:UpdatePanel ID="upnlGrid" runat="server">
                <asp:GridView ID="gvAssetAlloc" runat="server" AutoGenerateColumns="False" 
                    BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="3" CellSpacing="2" Font-Names="Arial" Width="513px" 
                             <td width="100px" height="20"></td>  
                               <td width="100px" height="20"></td>  
                               <td width="100px" height="20"></td&g

GridView: Hide validators and show validator summary


Hi, I want to have TextBox validators like in this case: http://msdn.microsoft.com/en-us/library/ms972948.gridview_fig45l(l=en-us).gif

I transfer the code to my necessities but the error message, displayed at the textbox, is the same as in the summary.

In the msdn - example there is only a asterisk at the respective textbox where the validation fails and the full error message is displayed in the summary.

How can I handle this? It seems to me that the validation summary only repeat the single error messages of the validators. When I set the single validators vissibility to "hidden"(which I would also use, because I thought they are still displayed in the validation summary -_- ), they are not displayed in the summary too.


How to hide a gridview when no new record entered


In my aspx page, I have a formview and a gridview. I am using the insert template of the form to insert an application number and applicant name both of which the user will enter.

I have a insert stored procedure that checks if that same number exist, it won't enter one, if not it will. ID of that table is autoincrement.

If a new number entered, it should show in the gridview as in my query I am asking to show the max ID. The applicatin number in the grid is a hyperlink which allows the user to go to a details page.

My problem: Whenever I click the save button in the formview, the grid becomes visible with the last created number. It is ok if the system allow to enter a new record. But if the number is a duplicate and the system does not enter a new number, still the grid shows with the last created number.

How can I implement what I want to do.

The stored procedure is:

ALTER PROCEDURE [dbo].[InsertNewChurchApp]nvarchar

Nested Gridview Show/Hide ?



I have a nested content in a grid.

I have to show that content on click of show button and similar to hide the same button i have to click.

It should be in client side.

I have done like this, when i click on show/hide in the bottom of <p> tag all the content of the grid it's showing and similar for hide also happening.

If any one have good code apart from this, please i needed ur help.

<script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">

    <style type="text/css">
border:solid 1px #c3c3c3;
    <form id="form1" runat="server">
        <asp:GridView ID="g1" runat="

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend