gridview

How to programmatically insert a row in a GridView?

i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al. I am researching this for a client and for an article, and i think my google-fu is not strong tonight. Any suggestions? EDIT: I actually ha...

Prevent user from resizing columns with WPF ListView

hi there, i wonder how i can prevent a user from resizing GridViewColumns withing a WPF ListView control as google doesn't came up wit a solution. probably one of the wpf guru's over here ;) ...

How do I Update a GridView from a Page Method from code behind?

How do I update a Gridview on a aspx page from a webmethod? Here is my code. [WebMethod] public static string GetDate() { return DateTime.Now.ToString(); } I can't use the "findcontrol" or the "this" methods so I need some help. ...

ASP.NET GridView CommandField Update/Cancel does not wrap

Hi. My question is on the ASP.NET GridView control. I am using a CommandField in the Columns tag as seen below. <asp:CommandField ShowEditButton="True" HeaderStyle-Width="40px" UpdateText="Save" ButtonType="Link" HeaderStyle-Wrap="true" ItemStyle-Wrap="true" ItemStyle-Width="40px"/> What renders is the shown in the following image ...

What is a good way to output an asp.net, C# GridView into a PDF.

I tried using the Microsoft ReportingControls but found them overly cumbersome, with too little documentation. I'd like a simple control that would convert a GridView control into a PDF document. I've started looking into PDFSHarp and am running into dead ends with documentation. Same thing with iTextSharp. I'm willing to dig into th...

Programatically determine column name of GridView controls?

I have a row of data that I need to modify in a database, using a stored procedure. But in order to call that stored procedure, I need to know the name of the each column. How do I determine the name of the columns? (Hardcoding is not an option as we are talking a LOT of columns whose names may change). EDIT: given the accepted answer, ...

How do you make GridView load images with a DataSet in ASP.NET 2.0?

I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT NULL, CATEGORY_ID int NOT NULL, IMGDATA image NOT NULL, CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL, MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'), IMGTHDATA image NOT NULL In my code-behind I have this: string tableName = "C...

How to add different controls in Gridview?

I know it's possible to change some columns in GridView controls to check boxes and when you are editing certain rows, the cells being hi-lited become text boxes, but supposed I want to add other controls in my gridView. For example: in the image below how would I change the entries of CategoryName to be a dropDown box of possible choice...

Ajax and GridView-Fu -- how to make AccordionPanes work with GridViews?

Ok, I know someone here has tried this ninja-elite level of coding before. Essentially what I want to do is this: I want a GridView where each row returned becomes the header portion of an asp.net-ajax AccordionPane. Each row also has some unique key, and when you click on each of those AcccordionPane headers, that will in turn reveal t...

Putting a gridview row in edit mode programmatically

How do I put a gridview row in edit mode programmatically? ...

Selectively apply css to a row in a gridview

Hi, I'm looking for a way to selectively apply a css class to individual rows in a GridView based upon a property of the data bound item. e.g.: GridView's data source is a generic list of SummaryItems and SummaryItem has a property 'ShouldHighlight'... when ShouldHighlight == true the css for the associated row should be set to 'highl...

Trying to reap the benefits of the Rich WEB.UI.Gridview control in a C# application

I know that I can't use this web control in my C# windows application and that I am restricted to DataGridView control. But this does not display results in an elegant manner as the Web.UI.Webcontrol.GridView control but instead displays it like the results when a SQL query is executed in sql server. I prefer not going down the path of ...

Can I convert a boolean to Yes/No in a ASP.NET GridView

I have a ASP.NET GridView with a column mapped to a boolean. I want do display Yes/No instead of True/False. Well actually I want Ja/Nej (in danish). Is this possible? <asp:gridview id="GridView1" runat="server" autogeneratecolumns="false"> <columns> ... <asp:boundfield headertext="Active" datafield="Active" datafo...

Javascript before asp:ButtonField click

Hi, I have a "GridView" control in an Asp.net application, that has a <asp:buttonField> of type="image" and CommandName="Delete". Is there any way to execute a piece of javascript before reaching the "OnRowDelete" event? I want just a simple confirm before deleting the row. Thanks! EDIT: Please Note that <asp:ButtonField> tag does no...

What is the best way to sort using a GridView and LINQ?

The one thing that LINQ seems to be missing for me is a way to reference columns by text string. For example, I have a typical GridView set up with sorting like this (the DataSource is bound to a LINQ query in the code-behind): <asp:GridView ID="MyGridView" runat="server" AllowSorting="True"> <Columns> <asp:BoundField DataFi...

Get GridView selected row DataKey in Javascript

I have GridView which I can select a row. I then have a button above the grid called Edit which the user can click to popup a window and edit the selected row. So the button will have Javascript code behind it along the lines of function editRecord() { var gridView = document.getElementById("<%= GridView.ClientID %>"); var id = // s...

gridview dynamic image change in imagebutton

I have a gridview containing some data from db, and after a check I want to see a small cross/tick image in each row, due to the result of the check.How can I change the image url dynamically? ...

Binding ASP.NET GridView to an Oracle SYS_REFCURSOR

We have a Procedure in Oracle with a SYS_REFCURSOR output parameter that returns the data we want to bind to an ASP.NET GridView control. I've seen this done before but I can't find the original reference I used to solve the problem. Here is what the procedure looks like: create or replace PROCEDURE GETSOMEDATA ( P_Data OUT SYS_REF...

Editable WPF GridView Row

I am trying to create a databound WPF GridView whose rows can either be read-only or editable (by double-clicking or through a context menu). I would like for the row to return to a read-only state if any of its editable controls loses focus. The functionality I am looking for is very similar to this example but with an entire row being ...

Problem adding dynamic columns to an ASP.NET Gridview

I'm having a problem dynamically adding columns to a GridView. I need to change the layout -- i.e. the included columns -- based on the value in a DropDownList. When the user changes the selection in this list, I need to remove all but the first column and dynamically add additional columns based on the selection. I have only one colu...