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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Putting Gridview into editmode having datasource=reader

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :ASP.Net
 I have a GV that is populated via a reader: Using reader As SqlDataReader = cmd.ExecuteReader() I have autogenerate edit button=T but it will not go into editmode. Must I create template to handle this?  

View Complete Post

More Related Resource Links

Manually sorting and paging Gridview without using datasource control

Many a times while working with Gridview we want to work with the paging and sorting functionality without using any datasource control. Gridview is flexible enough to perform these tasks without the use of any datasource control and only a few lines of code.

Configure Datasource using gridview problem


Hi i  have one asp.net textbox control..

and one dropdownlist inside gridview itemtemplate textbox..

what my problem..?

A Textbox36 has values some thing like this A1','A2','A3

i wirte this below query in sqldatasource1 and this sqldarasource1 is binded to gridview ItemTemplate Dropdownlist..

Select ItemName from Table1 where code in (@C)

Here @C im refering to Textbox36..

It show me the record if it has one value if its multiple like A1','A2','A3 it not showing/filtering ItemName data..

Whatz the probel?

Editmode on GridView inside of ListView

I have a listview and inside the listview I have a gridview.  I'm binding data to the listview, then on the listview itemdatabound I'm binding the gridview. I want to make the gridview editable so I have an edit template and an edit command button.  I have the event rowediting and inside there I set the edit index. Now normally I rebind the control and everything works.  But if I rebind this gridview, nothing happens. I can trace through the rowediting and everything is working.  It's setting the edit index, it goes through the databind and gets the right data and binds it to the control. What is happening?  Why isn't my rebound edit mode gridview showing up?

Problem Binding DropdownList in a gridView to a datasource

I have a Dropdownlist in an itemTemplate in a gridview. My gridView binds to dataTable1 (from which the selected value for dropdown comes from) and dropDown binds to dataTable2 (i need to get DataValueField and DataTextField from here).<asp:TemplateField HeaderText="Category"> <ItemTemplate> <asp:DropDownList ID="Cat" runat="server" SelectedValue='<%#Bind("CATEGORY") %>' > </asp:DropDownList> </ItemTemplate> <FooterStyle BorderStyle="None" /> <HeaderStyle BorderStyle="None" /> <ItemStyle BorderStyle="None" /> </asp:TemplateField>How do I do that? thanks in advance!

Refreshing GridView at x secs.but, stops in Editmode, then continues after.

Hello World,I have a Gridview that shows my data, I allowed it to have Editing and Sorting. I have achieved refreshing my GV with <META HTTP-EQUIV="Refresh" CONTENT="15">. however, when I Edit and it hits the time to refresh, I loose the Edit mode and starts at the beginning of the grid (I need to find the data again.)Is it possible to still have the refresh (15secs) then when Iam in EditMode, the Refresh stops, then after I have clicked UPDATE. the refresh time starts to count again. (i use VB)Regards,

Why does "reader" in my c# codebehind skip the first row of data when binding to a gridview?


Argh.. I'm making the switch from vb.net to c#, and am just trying to bind some data from a reader in my c # codebehind, but no matter what, the gridview always skips the first row returned from my stored procedure.  What am I doing wrong???

comm.CommandText = "123456";
comm.Parameters.AddWithValue("@SubSectionParentID", SubSectionParentID.Text);

reader = comm.ExecuteReader();

                  while (reader.Read())
            gvMenu.DataSource = reader;


How to set Dataset as datasource of a gridview in aspx using vb



i am using a gridview control in my aspx page. I want to set a Dataset as the datasource of the grid at programming end. But after filling the data in dataset and setting the data source property to Dataset grid is showing nothing.


If anyone can have any suggestions than please reply.


GridView - putting TemplateField fields in between data bound fields


Here is my problem.  I have a GridView, and I want Column1 to be equal to datatable data (filled by a SqlDataAdapter).  Then I have two other fields by the SqlDataAdapter (first name, last name), and I want to have those two fields combined to form Column2.  I have a TemplateField for my GridView that combines the first name and last name with Eval()'s, but the GridView places this combined field TemplateField and puts it as the first column.

How can I do this so that TemplateField can go in between fields that are databound?  Thanks in advance. :)

Problem with datasource and gridview


I have a very simple form that contains an asp:GridView and a PgSqlDataSource (a datasource control for PostgreSQL from DevArt.com) which is part of a web site.

The asp:GridView is defined as follows:


Sorting Issue in Gridview with Datasource



am having trouble figuring this one out.

Am using stored procedure and using databind for the gridview . i got the codes off other sites. I'm guessing its the code that i've underlined,
how or what do i use as the datasource for the sorting event. I used the Session for the paging event and that works but not for sorting.
any help would be appreciated.

 protected void LoadComplaint()

            gvComReport.DataSource = CompTypeStatusBLL.GetComplaint(ddlStatus.SelectedValue, ddlType.SelectedValue);
            Session["MyDataSet"] = gvComReport.DataSource;


 protected void gvComReport_Sorting(object sender, GridViewSortEventArgs e)
            DataTable dtSortTable = Session["MyDataset"] as DataTable;

            if (dtSortTable != null)
                DataView dvSortedView = new DataView(dtSortTable);
                dvSortedView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);

                gvComReport.DataSource = dvSortedView;

 private string ConvertSortDirectionToSql(SortDirection sortDirection)
            string newSortDirection = St

How to Leave footer visible in gridview when datasource is empty



I want to display my <FooterTemplate> or just the textbox and button when the gridview is empty. Here is the code I have that works fine when my datasource is not null but when it is null I want to show the <FooterTemplate> I have. 

Btw my project is VB.Net.  Oh yeah <emptydatatemplate> did not work for me.  I copied the below in between the <emptydatatemplate> and it did not work.  So I removed the template tags inside <emptydatatemplate> and still did not work. Any suggestions?

<asp:GridView ID="mlbGridView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="mlbDataSource" ShowFooter="True"  OnRowCommand="mlbGridView_RowCommand">

    <asp:Button ID="btnInsert" runat="se

gridview datasource update from another page


how can i said to a gridview to update his datasource from another page the point is that i'm on a gridview and then when o check fro details i open the details on a detailsview but i can change some info so when i save and returns back to the gridview it as the old info because datasource was not rebinded but i need to say what is the page and then use a find control but how can i said the anme of page?

what i want is this


i'm on page b and i want to update a gridview that is on page a

 page.[page a].findcontrol[mycontrol on that page]

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
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