gridview

GridView ASP.NET - passing a command and a ID to the code-behind

What is the correct way to pass a command and an identity Id (int) back to a code behind in ASP.NET. I'm looking at CommandName and CommandArgument. Am I reading it wrong but I think CommandArgument passes back the display index. How does this help? Can't figure out how I can set CommandArugment to the ID that I need. ...

ASP.NET GridView - Cannot set the colour of the row during databind?

This is driving me NUTS! It's something that I've done 100s of time with a Datagrid. I'm now using a Gridview and I can't figure this out. I've got this grid: <asp:GridView AutoGenerateColumns="false" runat="server" ID="gvSelect" CssClass="GridViewStyle" GridLines="None" ShowHeader="False" PageSize="20" AllowPaging="True"> ...

Gridview paging

Hi all, I am displaying the sales table data in grid view with field like itemid, itemname, quantity, cost. I have set paging, each page can hold 10 rows. In each page i want to calculate total quantity and TotalCost in two text box. When i am running the application by default in page1, in txtquanty and txtTotal cost should display the ...

DataTable must be set prior to using DataView.

When i try to sort my table manually, i receive this error: DataTable must be set prior to using DataView. The code is: protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { DataTable sourceTable = GridView1.DataSource as DataTable; DataView view = new DataView(sourceTable); string[] sor...

asp.net GridView not showing data from Stored Procedure

I have two GridViews, the first works fine as I defined the datasource when I dropped it onto the asp page via visual studio and I specified the table to use. The other GridView (dgvParams below) has just been dropped onto the asp page and I want to use it at run time: Imports System.Data Imports System.Data.SqlClient Imports myDataBas...

Dynamically Move Table Cell (up/down)-javascript

Group, I have a table that is dynamically built with device ids. I have a "swapCell" that moves the cells up and down when the user clicks on (up/dwn) buttons. I have a delete row function that deletes current row. -Problem is: If I have six rows (1,2,3,4,5,6) and six id's (id=row1,id=row2,id=row3,id=row4,id=row5,id=row6) -And dele...

Copy all datafrom 1 girdview to another,but those from 1st grid which are ticked...

I have 2 girds on same page. 1st grid contains data and have check boxes enabled i have to copy that data to other gird which is ticked.. on click of a insert button i have done this ..but it only copies 1 item from gird 1 to second plz help code done by me int RowNo = 0; foreach (GridViewRow row in GridView1.Rows) {...

Prevent HTML encoding in auto-generated GridView columns.

I have a GridView bound to a DataTable that I construct. Most columns in the table contain the raw HTML for a hypelinklink, and I would like that HTML to render as a link in the browser, but the GridView is automatically encoding the HTML, so it renders as markup. How can I avoid this without explicitly adding HyperLink, or any other, ...

GridView Paging Issue

I have a very simple GridView on one of my pages with the following markup on my .aspx page: <asp:GridView ID="gvNews" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" DataKeyNames="NewsID,VersionStamp" OnPageIndexChanging="gvNews_PageIndexChanging" OnRowCreated="gvNews_RowCreated...

Why not we use Repeater Control instead of Gridview Control ?

I know GridView control comes with lot of built in functionality, which we can achieve from repeater control. GridView control has performance issues. Why don't we use repeater? You will be thinking why this question, if you can achieve the functionality and performance using repeater use it, but I want to understand why and when we sho...

Dropdownlist in gridview's EmptyDataTemplate is not populating

<EmptyDataTemplate> <asp:DropDownList ID="ddlRateCode" runat="server" DataSourceID="odsRateCode" DataTextField="RateCode" DataValueField="RateCodeID" SelectedValue='<%# Bind("RateCodeID") %>'> </asp:DropDownList> </EmptyDataTemplate> ...

How Grid paging works?

Hi The paging is working fine here, the problem is I don't know how it works, because when I put a break point and a logger in the GetCustomers method, I found that parameters maximumRows and startRowIndex are always 0, 0. I have no clue why StartRowIndexParameterName, and MaximumRowsParameterName are created and how they are used. If...

Using JQuery in lost focus event handler to identify which row in GridView has modified text

I've got a textbox in an ItemTemplate inside of a standard ASP.NET GridView. The textbox (from DevExpress) supports a client-side event 'LostFocus'. From the LostFocus event handler, I'd like to retrieve the value of that textbox as well as the value of several other fields in that row of the grid, so that I can update one of those other...

Set Web User Control Property to GridView Selected Row

I have a web user control (ascx) that exposes an "ID" property. What I want to do is set this property when the SelectedIndexChanged event fires in a gridview in the containing page. However, I can't seem to do it.... Here's my code: protected void grdPhysicians_SelectedIndexChanged(object sender, EventArgs e) { physicians_...

Update SQL Server from GridView with a Checkbox

Hi all There is a GridView with a Checkbox field on the page. And there is a button on the same page. There is a field which is related to the checkbox in the sql. Is there any simple way to update the sql? Not row by row. Best Regards, ...

Custom Pagination Vs Default pagination in a gridview

I have the following questions regarding pagination in a gridview.. First as a beginner i used default pagination for all my gridviews.. After checking out some articles on performance they all focus on custom pagination... Is it a bad practice to use default pagination of a gridview? When to use custom pagination over default paginat...

Using a session variable in the where clause of a LINQ statement

Good afternoon all. I have a page that displays data in a gridview based upon what the user selects for a material in a radiobutton list and how many they wish to see, a text box. Upon logging into this page, a session variable for MemberID is created, MemberKey. What I would like to do is pass this session variable into the LINQ stat...

Gridview Refresh Problem

Hi there, I have a gridview in an asp.net page, and get the data by binding it to a SQL Server Table, I use C# and Stored Procedure in SQL server to bind the data. every thing works fine,except when I Delete multiple rows by using Stored Procedure, the gridview still shows the old data. actually I have couple of text boxes that the user...

ASP.NET GridView 'Page Not Found' on PostBack

I have a GridView that (in one particular instance) would contain about 5000 rows, each row containing a DropDownList with about 5000 items. Naturally, this takes forever to load and throws and OutOfMemory exception on my box. No big deal, I thought. I'll just enable paging. Well, that works fine (for the same gridview) when its bound...

Break large text at comma in GridView

I need to break this text on commas in asp:GridView: aaaaaaaaaaa,aaaaa,aaaaaaaaaa,asdsad,aasfasfa,sfasfasfsfasfasfa,afasf. This text is stretching field too much. I have tried with css and with label control as field but has no result. ...