Forms Data Controls :: Unable To Hide Or Remove Some Column Of GridView?

Feb 10, 2011

I am facing a problem with Gridview control. I have created a Gridview1 which is having 3 button column that has been added at design time and some column can be added through the Datatable at runtime. At Design time GridView1 has 3 button column

At Runtime I do GridView1.Datasource=dt; //Now my gridview is having 7 columns i.e. 4 more columns added through datatable.

I can easily display that GridView1 on webpage but I dont want to show some column that I added through Datatable to the user.

When I try to hide that column, I get error like Index out of bound exception but when I hide button column I can able to do that easily.

View 1 Replies


Similar Messages:

Data Controls :: How To Hide Column In GridView And Access Value Of Hidden Column

Aug 16, 2013

As per my requirement, I am getting CompID, Company Name and URL from SQL database. I want to display just CompName and URL in gridvew. So, I need to hide the CompID in gridview. One way I can do BoundField field Visible to false but I need to retrive that compID id when user selected any of the row. if I set visible to false user wont see any compID in gridvew but I want access the selected compID also using SelectedRow.Cells[1].Text..

View 1 Replies

Forms Data Controls :: Hide Column From Gridview?

Oct 5, 2010

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

[Code]....

How can I hide the coulmn, so other coulmn value can show remain, and colspan get also adjusted.

View 5 Replies

Forms Data Controls :: How To Remove Hyperlink When The Gridview Column Value Is 0

Mar 8, 2010

[code]....

BroughtForward and Pending both columns contain hyperlink values. When we click the values then another page opens with the details. I don't want to open another page if user click 0 in any column or in other words how to remove hyperlink if there is 0 in any cell?

View 16 Replies

Forms Data Controls :: Gridview Hide Column If Row Is Empty?

Feb 10, 2011

provide an example to do that... "Hide column if row is empty" in Databound()

datasource could be .1

coulmn: id-value1-value2-value3

row: 1-4-3-NULL (output: hides row value3) because the value is NULL

.2

coulmn: id-value1-value2-value3

row: 1-4-NULL-NULL (output: hides row value2,value3)

View 8 Replies

Forms Data Controls :: How To Hide Gridview Column Programmatically

Mar 24, 2010

I've programatically created a DataView item by adding columns and rows to a table in the class file. Then I add that to my webform using a GridView. I'd like to hide some of the columns so that the end user doesn't see them but still be able to access their values.

How do I do this programatically? The table.Columns.Count returns the actually number of columns. Somehow when it converts into a DataView, it is only returning 1 column.

//From class file

[Code]....

//From webform

[Code]....

In this example, I want to hide the ID column.

View 2 Replies

Forms Data Controls :: Remove Delete Button From Gridview Column?

Mar 24, 2010

i am working with a gridview and created it in following way:

[Code]....

Now i want to remove the Select, Edit and Delete link buttons in the last columns for a particular row. It should remain as it is for other rows. Only linkbutton from a particular row(being determined from data key) is to be removed.

View 12 Replies

Forms Data Controls :: How To Show / Hide TemplateField Column Of GridView

Feb 19, 2010

I am trying to show/hide TemplateField of gridview but not getting it... here is ma sample aspx code

<asp:TemplateField HeaderText="ColumnA">
<ItemTemplate>
<asp:Label ID="lblTest" runat="server" Text=' <%# Eval("Test")>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

Now in server side i am trying to hide this column but failed !!

protected void gv_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header || e.Row.RowType == DataControlRowType.DataRow)
gv.Columns[2].HeaderStyle.CssClass = "hiddenClass"; // here i am setting display:None using css class
}

how to show/hide TemplateField on server side

View 5 Replies

Forms Data Controls :: How To Use One Button To Show And Hide A Column On A Gridview Without Using JavaScript

Jan 17, 2010

I have a gridview, which contains a template field with a button. On this button, I want to show and hide another column with this one button. I don't want to use Java Script because my site already uses a lot of this and AJAX. So, can someone show an example of some code behind, which is what I want to do on how to show and hide another column on a gridview?

View 1 Replies

Forms Data Controls :: Unable To Set GridView Column Width

Sep 23, 2010

I have been searching the internet for a solution to this for hours. I have tried all of the following methods to set the column width on my GridView control:

1. <asp:TemplateField HeaderText="ColumnHeader" ItemStyle-Width="100px">
2. <ItemStyle Width="100px" Wrap="False" />
3. GridView.Columns[0].ItemStyle.Width = 100 both on the PageLoad event and, out of desperation, on the RowDataBound event.

I have tried these settings by themselves and in combination. I have also experimented with different CSS width settings for the GridView and its containing <div> (including none) to no avail. The GridView columns are always equally spaced and wrap the row description text in the first column in a rather ugly fashion. As this needs to be fixed for a presentation to a client on Monday, I would be eternally grateful to anyone who could point me in the right direction.

View 4 Replies

Forms Data Controls :: Unable To Set Column Max Width In A Gridview

Feb 19, 2010

I have a gridview and I want to fix the column size to a certain size regardless of the length of the data in a given cell.

I have tried everythign I can think of from

gvwProjects.Columns[1].ItemStyle.Width
gvwProjects.Columns[1].ItemStyle.Wrap

to setting the length of the lblContol in the template but no matter what I do the column size automatically increases beyond my fixed size to meet the size of the longest cell in the bound datatable.

View 1 Replies

Data Controls :: How To Hide A Column Inside GridView

May 7, 2015

I want  hide a datacolumn of GridView  but still access its value in asp.net c#.

View 1 Replies

Data Controls :: Hide Particular Column In GridView In Code Behind

Jan 1, 2014

I have two columns in gridview

CustomerId                   CustomerName

Now how to hide column CustomerId programmatically??

View 1 Replies

Data Controls :: How To Hide Specific Column Of GridView

Jun 25, 2013

I have 5 column, in first two column read only id in hidden field, but in UI first two column shows empty,this two column in UI does not show only show remaining three column, then how to hide first two column using css ...

View 1 Replies

Data Controls :: Hide Gridview Column With Session Variable?

Apr 27, 2016

With reference to the following link: [URL]

I have a column on Page1 gridview which holds Edit and Delete button.My question is how can i remove or hide the Edit and Delete button column on Page2 gridview so that the buttons are not visible?NB: The Gridview is tied to a session which was from page1. So on Page2 the buttons should not be seen...

View 1 Replies

Data Controls :: How To Hide A Column In GridView Inside DataList

May 7, 2015

I have a gridview inside a datalist, i need to hide a particular column of that gridview inside datalist. how should i proceed????

View 1 Replies

Data Controls :: Display Only Date And Remove Time In BoundField Column Of GridView

May 7, 2015

I have SQL2012 database, which has a Table with many columns in it . One of the columns is "Start Date" and i set the dataType to "Date". Now I am putting the data into a gridview but the data is different to the database, the "Start Date" column has time as well. why this is happening ( the Start Date column is the gridview is a BoundField).

View 1 Replies

Data Controls :: Show Hide Button In GridView TemplateField Column Conditionally?

Dec 5, 2013

i have a gridview, in my gridview, i have a attachment button.

when user click on the attachment button, it will direct them to EquipmentAttachment.aspx.

what i want to do right now is, if the attachment exist, then the attachment button visible, else the button attachment set to false.

View 1 Replies

Data Controls :: How To Hide GridView Column But Data Must Be Accessible In Code

Jun 25, 2013

I don't know how to access,...

View 1 Replies

Data Controls :: Dynamically Show Hide Label And HyperLink Based On Condition In Same Column Of GridView

May 7, 2015

I am checking string  and then bind category. If condition is false then i  need anchor tag in which i pass querystring to specific link.

<itemtemplate>
<asp:Literal runat="server" ID="litPrice" Text='<%#((String.IsNullOrEmpty(Eval("Price").ToString()) || Eval("Price").ToString()=="00/0.00" || Eval("Price").ToString()=="0/0.00") ? "<span font-family="arial"><a href="http://www.xyz.com/web/enquiries.asp?category="+ Eval("category")>Enquiry</a></span>" : Eval("Price"))%>' >
</asp:Literal>
</itemtemplate>

I am getting error. CS1010: Newline in constant

View 1 Replies

C# - How To Hide GridView Column When Data Is Accessed Dynamically In Gridview

Feb 25, 2010

I have 2 gridviews they are bind by sqldatasource ,it contains Id , Name and Price

i dont want to show ID coloumn when page is loaded.How to hide it?

View 1 Replies

Forms Data Controls :: Remove Spacing To Before The First And After The Last Column?

Nov 9, 2010

When creating a new column chart, by default a lot of space is inserted to the left of the first column in a series, and to the right of the last column. This means that a lot of space is wasted in the ChartArea.

How can I get rid of this spacing? In other words, how can I align the columns in a column chart so that the first column is all the way to the left of the chart area, and the last column is all the way to the right in the chart area?

Note: I have tried asking this question in the social.msdn "Chart controls" forum [URL], however there does not seem to be many people answering questions there.

View 1 Replies

Forms Data Controls :: How To Hide A Column In A Grid View

Aug 19, 2010

i have a grid view myGridView. I populate this gridview in the page load event as:

myClass newObj = new myClass();
myGridView.datasource = newObj.getItems();
myGridView.databind();

Now I wanted to hide some of the columns of the grid view. How I can do that?

View 5 Replies

Forms Data Controls :: How To Hide A Template Column In A Griview

Mar 29, 2010

I am trying to hide the first column of my gridview, a template/command column.

I want to export my gridview to Excel and the teplated contol shows up in the Excel file as a column.

This is what I tried in code :

Me.GridView1.Rows.Item(0).Visible =
False - This doesn't work !
Me.GridView1.AllowPaging =
False
Me.GridView1.AllowSorting =
False
Me.GridView1.EditIndex = -1
Me.DataBind()
Response.Clear()
Response.ContentType = "application/vnd.xls"
Response.AddHeader("content-disposition",
"attachment;filename=SearchedItems.xls")
Response.Charset = " "
Dim swriter As
New StringWriter()
Dim hwriter As
New HtmlTextWriter(swriter)

View 1 Replies

Forms Data Controls :: ListView Control Column Hide?

Jan 28, 2011

How can I make the column of ListView Control invisible. The last column's header I have put in a label control and its item are in a html img control .

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved