gridview

GridView Checkbox Column

I used to have a class in 1.1 for the Datagrid that inherited from the DataGridColumn class. This allowed me to create a check box column with a client-side un/check-all box in the header. Then as I designed my grid I would just add my custom column. I am currently on a project where I need similar functionality for the grid view, howev...

GridView item text wrapping

I have a GridView control that I am dynamically creating at runtime. I am creating all the columns like this. foreach (GridColumnConfig column in columns) { BoundField boundField = new BoundField(); boundField.HeaderText = column.Title; boundField.DataField = column.FieldName; boundField.SortExpression = column.FieldName...

Gridview sorting: SortDirection always Ascending

Hi ! I have a gridview and I need to sort its elements when the user clicks on the header. Its datasource is a List object. The aspx is defined this way : <asp:GridView ID="grdHeader" AllowSorting="true" AllowPaging="false" AutoGenerateColumns="false" Width="780" runat="server" OnSorting="grdHeader_OnSort...

Format columns for ASP.Net GridView based on data type.

I have a very simple ASP.Net page that acts as a front end for a stored procedure. It just runs the procedure and shows the output using a gridview control: less than 40 lines of total code, including aspx markup. The stored procedure itself is very... volatile. It's used for a number of purposes and the output format changes regularl...

GridView/ObjectDataSource inside runat=server container does not bind

I've got a small web form with 2 radio buttons, call them PickFromList and EnterValue. When PickFromList is checked I want to show a GridView that I've configured to bind to an ObjectDataSource. When EnterValue is checked I want the GridView to disappear. This form is laid out using a table and want to hide/show the appropriate rows b...

Formview Being Cleared

My problem is that all the textbox's my formview are getting cleared when I hit the submit button. I currently have a page with a small section that has an update panel around it. This small section adds an address to my databse. To the left of this form there is a gridview that is tied into the formview. So if i click on an item in the...

how can i use Hyperlink button in gridview ?

How can I use Hyperlink button in gridview. I mean when I run my program,all data is displayed in gridview,but I want hyperlink in gridview, so that when I will click in hyperlink it will show the select path which is in gridview : if there is pdf file path and I just click on this hyper link then I can see the pdf file. Can you tell me...

ASP.NET Grid with frozen columns

I need a grid that will allow me to freeze a column (the Ms Excel style). I do not need to freeze rows. Of course the Asp.net 2.o Gridview does not supports this out of the box. I am sure someone has had a similar requirement and had a way foward. Please advise any options available with the Gridview. I am also open to using any third...

One gridview - two datasources?

I am working on a co-workers website, and he mistakenly put up a gridview that shows a TypeID instead of the TypeName. I want to put the actual NAME of the type, instead of it's arbitrary ID number, like he has it. I see he has two "ObjectDataSource"'s on the page -- one for Type and one for Item. Items contains the ID of what TYPE th...

Capturing the Enter key when editing a GridView textbox

I have a GridView defined like this: <asp:GridView ID="myGridView" ruant="server"> <asp:BoundField DataField="myField" /> <asp:CommandField ShowDeleteButton="true" ShowEditButton="true" /> </asp:GridView> After I put a row into edit mode with the Edit button, how do I capture the Enter key and trigger the resulting Update on t...

How to bind a label inside a gridview to another table?

I have a very standard Gridview, with Edit and Delete buttons auto-generated. It is bound to a tableadapter which is linked to my "RelationshipTypes" table. dbo.RelationshipTypes: ID, Name, OriginConfigTypeID, DestinationConfigTypeID I wish to use a label that will pull the name from the ConfigTypes table, using the "OriginConfigTypeID...

Gridview sorting challenge when moving from Winforms to ASP.NET 2.0 Webforms

I have a problem with Gridview sorting that is similar to others but I'm binding to a collection object as opposed to a data table. The existing business rules and data access layers of an application follow the pattern of having an object and, if you need a collection of objects of that type, to have another class inheriting Collection...

Freezing gridview header in a fixed width div

I have seen some gridview header freezing examples on the web but I have a special case where the gridview is in a fixed width div. The examples I tried make the header fixed but the full width of the header is shown and it overflows out of the div while the grid body has a horizontal scroll bar. I need it to: 1- Header and tbody scroll...

"Both DataSource and DataSourceID are defined" error using ASP.NET GridView

"Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition." I just got this error today, the code has been working until this afternoon I published the latest version to our server and it broke with that error both locally and on the server. I don't use "DataSourceID", the application reads database qu...

Cannot cast DataItem to DataRowView in Custom Binding Scenario

I have an object that returns an IList which I'm getting from my ObjectDataSource and binding to a Gridview. All works fine if I just use standard binding, but I'm trying to customize my binding to set properties on a linkbutton as follows: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { ...

Custom datatable with metadata used for binding to a Gridview?

I'm binding a datatable to a gridview control, and when I format each column I need to format the data based on whether that column has a particular custom attribute. In this case, a column can represent: a text box (in which case I just display the text from the textbox in the gridview), a checkbox (in which case I display "Checked" ...

Turning off ASP.NET CSS Friendly Adapters

The CSS Friendly Control Adapters for ASP.NET are great for creating markup that is easy to style. A big benefit of the GridView adapter is that it generates THEAD, TBODY, and TFOOT tags, which allow you to do some really great things with libraries like jQuery - for instance, Tablesorter for client-side table sorting. The problem is t...

Editable Datagrid? Repeater?

I've got a list of items in an order to show in asp.net -- each item (row) will have 3 textboxes so the user can both view and change that piece of data (shipping cost, handling cost, price). What would be one "recommended" way to accomplish this? With a repeater, I assume I'd then have to loop through the form values on postback, and ...

Vertical scroll bar does not appear when the gridview items exceeded the display height

I place the following statements in the second row of my grid in the xaml: <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1"> <ListView Name="listView" Margin="5" Grid.Row="1"> <ListView.View> <GridView AllowsColumnReorder="True"> <GridViewColumn DisplayMember...

Problem Displaying XML in Grid View-newbie

I am trying to do something in VisualWebDev 2008 Express that I thought would be simple, but it is not working. I want to display data from an XML file so I added the XMLDataSource to my page, pointed it to the XML file, and then added the GridView and connected it to the datasource. I am getting the following error: GridView - GridView1...