.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Gridview question

Posted By:      Posted Date: September 25, 2010    Points: 0   Category :ASP.Net
 

I have a page which as been working just fine for months, that is simply pulling SQL data to a dataset, and on the RowDataBound event, I am adding a new cell to the row, a hyperlink to another page which is based on text data in certain columns of the row. All of that is fine. This week I have been trying to figure out a way to add one more column based on a user request. They would like to have a checkbox column and a button that performs an act with each of the checked items. This value doesn't need to be stored anywhere, and is only used in the session to determine what rows this action is taken against.

I am a noob to asp.net, usually spending time in Winform apps, but trying to help someone out by providing web page access to some data. I have scoured the pages trying to sort out whether I need to rewrite the page and data access in some way but there seems to be many many different ways people have solved similar problems. I think I have gotten really close a few times but either end up with a checkbox which I cannot get the value for (by adding cells in the same code that adds the hyperlink), to adding a templatefield. In this attempt what happens is that if I keep autogeneratecolumns=true then my databinding blasts over the templatefields and if I set it to false, nothing happens on databinding.. 

I really apologize to the many advanced users who


View Complete Post


More Related Resource Links

GridView Question - Please Help Me...Should Be Simple...

  
Hello,I have what I think should be a simple GridView question but I can't find the answer.When I want to update a row in Gridview I click on the "Edit" link.  It takes me into the row of the GridView where I can edit the values.Here's how it looks:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google When I click on "Edit" it looks like:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Update Cancel IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google As you can see, I now have the ability to update the CustomerID.  I don't the user to be able to update the CustomerID, only the CompanyName via the DropDown.How can I change the GridView to ONLY allow me to update the CompanyName?ThanksJason   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google

Question regarding C# Paging Gridview

  

Dear Experts,


i have an application in Vs. C# i have gridview with big data so its not in graphical mode so i want to paging in gridview . is there any command in C# to enter paging in gridview ?


Thanks


Sagheer


GridView question

  

I have a GridView. The data is displayed in TemplateFields: textboxes and dropdown lists. E.g. rows 5 and 7 have certain values selected in the dropdown lists of column 1. After I use filtering, still the same values are selected in rows 5 and 7, though because of filtering, different records are displayed in those rows. The same thing happens with TextBoxes.


Could you tell me how I could avoid preserving data after postback?


I tried to disable ViewState of the GridView or of the dropdown lists or textboxes, but that didn't help.


Thanks.


question about gridview updating

  

Hello, i have some GridView Using LinqDataSource1 (GridView1). i want the gridview to update everytime the user make something on page so im using GridView.DataBind() in the Page_Load method on code behaind (isPostBack statement) and its working fine!!! (the user make something on view1 on Multiview and then jump to view2 to see the gridview) the problem is, when the user want to edit some row in the gridview (using the gridview commands) the data dont update!! he can only delete rows. when im removing the isPostBack statement its working and the user can update and delete but i need the isPostBack so the gridview will update his rows. any idea?????


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="userFileId" DataSourceID="LinqDataSource1" 
            ForeColor="#333333" GridLines="None" Width="540px" Font-Names="Arial" Font-Size="X-Small">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="fileName" HeaderText="?? ?????" 
               

Gridview DataKeyNames question

  

Hi,

I am trying to get the delete to work on my gridview. I've added a

DataKeyNames="ID"

but when i click delete i get

Input string was not in a correct format.


Gridview column line wrap question

  

I have a ASP.NET gridview (embedded into a DIV) with several columns. For some columns line wraps are definied and for some not(with ItemStyle.Wrap = true/false). For all columns ItemStyle.Width is set to a specific value. Now I am wondering, that there is a line wrap in a column, where ItemStyle.Wrap = false. What could be the reason for that?


DataTable and it's Gridview - A Column Order Question

  

Well, I've been developing with gridviews for quite some time now.  Just recently I came across a situation that has me stumped.  Here's how the gridview has been working for me.

 

1.      A stored procedure from the database is called (three parameters are passed (reporttype, name, location)

2.     The data is retrieved using the SqlDataAdapter to fill a Datatable

3.     The gridview DOES NOT AUTOGENERATE COLUMNS

4.     Columns are created programmatically as it reads the DataTable results (headertext, datafield, and dataformatstring are set at runtime)

5.     The Gridview triggers the databind event - and voila it works.

 

My dilemma is this:  the stored procedure (that I haven't developed) returns a various set of columns and column order.  I have one report type that does the following:

 

ReportType 1:  column orders returned in the following order when running directly in SQL

            col B, col C, col D, col E, col A

 

when I run the report through my gridview, the column order is as follows:

          &nb

Inplace Edit in GridView

  
In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

  
JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

  
This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

AJAX GridView Checkbox Select All in ASP.Net

  
In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

AJAX GridView Paging and Sorting using C# in ASP.Net

  
To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

GridView Paging Using Ajax in ASP.Net

  
To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Displaying Row Details Tooltip on GridView using JQuery

  
Continuing exploring JQuery! I decided to implement a feature to display some kind of details related to a row displayed on GridView. For example when displaying employees details on GridView some information might not fit in the GridView because it will make it huge and wide. These infomration can be diplayed as Tooltip. Or when you want to display a picture and some kind of formated text to be diplayed as tooltip when mouse hover on the image.

jQuery: Highlight Gridview Rows with Checkbox

  
Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

Sortable GridView using jQuery's TableSorter

  
This article explains how to use jQuery's plug-in Tablesorter to implement client-side sorting in an ASP.NET GridView. This comes in handy especially when an ObjectDataSource is used with a GridView as GridView does not provide sorting out of the box.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend