gridview

GridView delete not working

I'm using a GridView in C#.NET 3.5 and have just converted the underlying datasource from Adapter model to an object which gets its data from LINQ to SQL - i.e. a Business object that returns a List<> for the GetData() function etc. All was well in Denmark and the Update, and conditional Select statements work as expected but I can't ge...

Display rows in multiple columns in Asp.net Gridview

By default each row of a Gridview maps to each row in a datatable or dataset attached to its datasource. But what if I want to display these rows in multiple columns. For example if it has 10 rows, 5 rows each should be displayed in 2 columns side by side. Also can I do this with the Infragistics grid. Is this possible? ...

Total row count in Gridview using LinqDataSource and paging

Hello, I'm having a problem obtaining the total row count for items displayed in a Gridview using Paging and with a LinqDataSource as the source of data. I've tried several approaches: protected void GridDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e) { totalLabel.Text = e.TotalRowCount.ToString(); } re...

Entire Page refreshes even though gridview is in an update panel

I have a gridview that is within an updatepanel for a modal popup I have on a page. The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I have grayed out the rest of the page so that the user cannot click on it this is very annoying. Does ...

Postback events from within DataView

I'm presenting information from a DataTable on my page and would like to add some sorting functionality which goes a bit beyond a straight forward column sort. As such I have been trying to place LinkButtons in the HeaderItems of my GridView which postback to functions that change session information before reloading the page. Clicking ...

Nesting a GridView within Repeater

I have a scenario wherein, for example, I need to repeat a list of US states and display a table of cities and city populations after the name of each state. The design requirement dictates that every outer repetition must be the name of a state followed by a table of cities, and that requirement cannot be changed at this time. Are there...

Best Technique for Multiple Eval Fields in Gridview ItemTemplate?

What is the best way to use multiple EVAL fields in a GridView ItemTemplate? Looking to have some control over formatting for appearance as well as setting up hyperlinks/javascript etc. ...

.Net Gridview alpha sorting, it needs to be numerically sorted

Hey guys, This is my first real question of need for any of those Gridview experts out there in the .NET world. I an creating a Gridview from codebehind and I am holding a bunch of numerical data in the columns. Although, I do add the comma in the number fields from codebehind. When I load it to the Gridview, I have the sorting abili...

Anyone have sample code for a UserControl with pager controls to be used in a GridView's PagerTemplate?

I've got several Gridviews in my application in which I use a custom PagerTemplate. I'd like to turn this custom template into a UserControl so that I don't need to replicate the same logic in multiple pages. I'm pretty sure that such a thing is possible, but I'm unsure of how exactly to wire the UserControl to the Gridview's events, and...

Autocomplete Textbox on Gridview editing

How do you implement autocomplete on ASP.Net Gridview? Can anyone point me where to go to achieve this? I'm willing to use non-.Net ajax controls if that what it takes. ...

ASP.Net GridView Size Formatting

I have an ASP.Net GridView control that I need to remain a fixed size whether there are 0 records or n records in the grid. The header and the footer should remain in the same position regardless of the amount of data in the grid. Obviously, I need to implement paging for larger datasets but how would I achieve this fixed sized GridVie...

Getting value from a cell from a gridview on RowDataBound event

string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty string. Any ideas? To clarify, here is a bit t...

Problem with a gridview, paging and "object reference not set" error

I'm stuck with the following problem. I'm trying to implement a basic GridView paged result set, which connects to an Oracle database. By itself, the GridView, and the paged results, work fine. The problem comes when I try to put it in page layout class that we have at work. We have ClassA, which inherits from Page, and is a corporate s...

How to sort columns in an ASP.NET GridView if using a custom DataSource?

I can't get my GridView to enable a user to sort a column of data when I'm using a custom SqlDataSource. I have a GridView in which the code in the ASP reference to it in the HTML is minimal: <asp:GridView id="grid" runat="server" AutoGenerateColumns="False" AllowSorting="True"> </asp:GridView> In the code-behind I attach a dynamical...

Getting a Linq-toSQL query to show up on a GridView

I have a pretty complicated Linq query that I can't seem to get into a LinqDataSsource for use in a GridView: IEnumerable<ticket> tikPart = ( from p in db.comments where p.submitter == me.id && p.ticket.closed == DateTime.Parse("1/1/2001") && p.ticket.originating_group != me.sub_unit select p.ticket ...

Totaling a GridView in ASP.NET

In one of my ASP.NET Web Applications, I am using a BulkEditGridView (a GridView which allows all rows to be edited at the same time) to implement an order form. In my grid, I have a column which calculates the total for each item (cost x quantity) and a grand total field at the bottom of the page. Currently, however, these fields are on...

ASP.NET GridView postback not setting posted controls' values

When adding an EditItemTemplate of some complexity (mulitple fields in one template), and then parsing the controls from the RowUpdating event, the controls that were manually entered by the user have no values. My guess is there is something going on with when the data is bound, but I've had instances where simply adding and attribute t...

How to freeze GridView header?

As in a title, does anyone know how to freeze GridView header in ASP.NET ? ...

How to sort gridview by column containing nullable integer?

I have a GridView where one column is bound to an object property containing a nullable integer. I set SortExpression to the name of the property, and sorting works perfectly as long as all rows contain a value. If any rows contain null, however, I get an exception: System.InvalidOperationException : Failed to compare two elements in th...

How do you bind a DropDownList in a GridView in the EditItemTemplate Field?

Here's my code in a gridview that is bound at runtime: ... <asp:templatefield> <edititemtemplate> <asp:dropdownlist runat="server" id="ddgvOpp" /> </edititemtemplate> <itemtemplate> <%# Eval("opponent.name") %> </itemtemplate> </asp:templatefield> ... I want to bind the dropdownlist "ddgvOpp" but i don'...