gridview

Is there a way to use a DataTemplate with a parameter?

I need to dynamically add/remove GridView columns, each displaying information from a different element stored in a KeyedCollection (indexed with tn 'int'). The basic technique works, but requires an index, as follows: <GridViewColumn Header="bid"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Width="60...

How do I implement sorting for a custom return type from a linq-to-sql query?

I am using a repository class with linq-to-sql as the objectdatasource for a (web) GridView. The GridView has to allow sorting on all columns. I have a working solution using this approach but I would obviously prefer to do this without a predefined list of sort expressions. public class TrailerMovementRepository { private TrailerMo...

AJAX Drop Down Extender problems updating Textbox with selected index value

Hello, I have a gridview where all rows are editable by default. Most columns require a simple textbox with some formating validators which are not an issue. I do however have 1 column that requires a List of Choices from which the user can select. To do this I am using the Ajax Drop Down Extender to bind to the textbox, so when the t...

How can I use a Button control instead of LinkButton for gridview sorting in ASP.Net

I currently am using an ASP.Net gridview control and when a sortexpression is defined on the column, the column header is rendered as a linkbutton. I want to know if it is possible to convert that LinkButton to a Button control and preserve all the functionality. I cannot use TemplateColumns because I using DataControlField implementat...

Get Current row from Gridview in ASP.NET

I have a Gridview with delete and edit buttons looks like <asp:GridView ID="grdTrackedItems" runat="server" AutoGenerateColumns="False" Width="330px" BorderStyle="None" OnRowDataBound="OnRowDataBoundTrackedItems" OnRowDeleting="OnRowDeletingTrackedItems"> <Columns> <asp:TemplateField HeaderText="Nam...

Problem with GridView UniqueID

Hello! I have a following problem. I have a page with a ModalPopupExtender. This extender is used to show a user control which contains a user control with a GridView on it. Now the problem is that when I get the UniqueID of the GridView's parent control it looks like: "ctl00$cphContent$hierarchyEditor$gvAvailableLevels" which is perfect...

Gridview Footer

I have one R & D for displaying the grid view footer on page loading. In my application i hit the add button the grid footer displayed with 3 text boxes and previously added values. When i clicking Add button it shows the values that are previously added and i have to scroll to get the text boxes. My requirement is that when the add but...

display icon with respective file

Ok this is something new to me.... I have a gridview control which is displaying the files and directory names in one column. Now i want to display the file icon of that particular file in the other column... eg test.txt will have a different icon form image1.jpg and here.xsl i have found two examples but don't kno if they will work ...

How to get the entity object from RowDataBound in a EntitydataSource bound gridview

I have a GridView that is bound to an Entity Framework object. I want to access the object in the RowDataBound event of the GridView. When I try to access the DataItem object i get an error stating Unable to cast object of type 'System.Data.Objects.MaterializedDataRecord' to type 'BBM.NailArtGallery.Model.Item'. Apparently the Materializ...

Gridview in ASP.Net

I've got two questions on how to do things in the new GridView. I'm used to the DataGrid in ASP 1.1, so I need the equavalent in ASP 2.0 Gridview. 1.) What is the equavalent for Item Command event in GridView? I thought it would be RowCommand, but I can't get that event to fire with a dropdown list field that I drag/drop in a template c...

ASP.NET GridView enumerating all Column ID's Programatically

I have gridView with columns (ItemTemplate/BoundField e.t.c) i need to get ID'd of each column, i am able to get HeaderText as shown below : foreach (TableCell objCell in e.Row.Cells) { if (objCell is DataControlFieldHeaderCell) { string HEAD...

Is it possible to do a custom sort on a GridView

Hi, I need to sort a GridView (Not DataGridView, it's not the same thing) that is in need of a complex sort and I don't know how it can be done. I have two column, one containing a date and another containing a priority. If the date is lesser or equal to today's date. I want to order by priority first, then by date. If the date is gre...

grid view Test box new line display

Hello, I am using grid view and item template text box in ASP.NET USING C#. I am entering text in one line and using entered key again entered text in second line. BUt after updating i am getting out put data in one line(I used 50 char length in one line.). Ex. My first line text. THIS IS TEST JAN 13TH. second line code Hello ravi ...

Wrangling datacontrols - Gridview with datasource, but using templates?

Hi, As apart of my learning, I want to learn more about the data controls in asp.net. I have used the gridview in situations where it is specifically bound to an sql data source and handles updates and deletes really easily, but I have thought of something that I want to model, however am not sure which control is best to use. The situ...

Pass values from QueryString parameter in GridView hyperlink

Hi, I'm using GridView with a hyperlink column, and I want to do the following: DataNavigateUrlFormatString="~/student/group/document/Body.aspx?DID={0}&GN={QueryString("GN")}" HeaderText="View Document" Text="view" /> How I can retrieve the value of GN from the QueryString parameter and add it to the hyperlink column ? ...

how to make row in gridview bold and regular programatically in c# 3.5

hi i have written program in c# outlook where u can send ,receive ,reply ,forward ,the mails in text format through database i used gridview to retrieve the mails but the new task is how to mark the unread message as bold and read message as regular in text. help needed ...

gridview in asp.net

How to make gridview row in bold? I've written the below code to do that but I get error Error 2 Cannot implicitly convert type 'int' to 'bool' my code is protected void ddlread_SelectedIndexChanged(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == Dat...

Nitobi Grid remove the add row and remove row buttons.

Hi, I am using the Nitobi Grid in my php website. I would like to remove the buttons like add row and remove row on the grid toolbar. I cant remove the whole toolbar as i need the bar for paginating. Please let me know if there is any way to remove these buttons. Any ideas are appreciated. ...

How to implement "Hide/Show Column" feature of Excel in C# GridView

I want to create a "Hide/Show Column" function for a GridView. Scenario: When user right-clicks to the header of a column and select "Hide", all the selected column will be hidden. Status: This is easy by setting "Visible" property or setting the Width to 0. But I want to imitate the effects done by Excel when a column is hidden. The ...

How can I Get all the rows of Gridview to be editable mode?

Getting all the rows of Gridview to be editable mode. Here is Gridview Source.. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ods" DataKeyNames="abc" EmptyDataText="There is no entry..." AllowPaging="false"> <Columns> <asp:TemplateField> <EditItemTemplate> ...