.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

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

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :SharePoint


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.


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?

jpg files will not display in gridview on aspx page

I have an image object in a template of a gridview The datasource of the image object evaluates to the path of the jpg file. However, the aspx page displays a little red x instead of the picture. How do I get the image to display/Frank learning vs 2005

Custom DynamicData Default.aspx GridView

On the Default.aspx page the GridView control is populated programmatically by setting its Datasource to a list of table objects. Is there some way I could populate this GridView manually using my own set of NavigateUrls and DisplayNames?Simon

How to retrieve all records from GridView and assign to DataSet

 Hi, I dont know why my GridView.DataSource is become nothing when the Page.IsPostBack = true.What i did is bind the dataset to the GridView.DataSource when page load. Then when the button click event is trigger i need to get all the records from GridView. But when i debug and check i found that the GridView.DataSource is become nothing. Can someone tell me how should i get all records from the GridView and assign to dataset. I'm using VB.net to work on. Thanks.

Show total items for GridView in List.aspx or GridViewPager

Hi, Is there a solution to show total items in Grid View in List.aspx or GridViewPager Eg. Record: 1 - 20 of 231 

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!

Querying, getting the results and re-using the results on a different datasource and dataset. Is it

Hello all,  I have a dataset that is running a very simple query, pulling an OrderID field based on the TransactionID parameter (User Input).  This dataset is pointed to Database_A. SELECT OrderID FROM Orders WITH (NOLOCK) WHERE OrderID = @TransactionID   Now, this query above might return one of more records. I need to query another system (Database_B) using the results from this query. I need to store the OrderIDs that I got somewhere and check them against another system and display the results on my report. Please note - Database_B is located on a totally different server.  Can you guys think of a way of doing this? I'm using SSRS 2008, not 2008 R2.

I am unable to indentify ..aspxCheckBox in aspx gridview ..can u please assist me

My code as followsprivate void BindDropdown()    {        BDM_CAMPUS objBLL = new BDM_CAMPUS();        BDM_CAMPUSEN enObj1 = new BDM_CAMPUSEN();        List<BDM_CAMPUSEN> listpro = objBLL.GetCampusDetailsForGradingScheme();        ASPxComboBox ddlCampusCode = (ASPxComboBox)gvGradingSchemeMaster.FindRowCellTemplateControl(3, (GridViewDataColumn)gvGradingSchemeMaster.Columns["CampusCode"], "idcampus");             ddlCampusCode.DataSource = listpro;        ddlCampusCode.ValueField = "CampusID";        ddlCampusCode.TextField = "CampusCode";    }<dx:ASPxGridView runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua"        ClientInstanceName="gvGradingSchemeMaster" KeyFieldName="GradingSchemeID" AutoGenerateColumns="False"        Width="100%" ID="gvGradingSchemeMaster" OnRowInserting="gvGradingSchemeMaster_RowInserting"       

Putting Gridview into editmode having datasource=reader

 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?  

Disable child links in list.aspx : gridView based on some row condations


In the list.aspx page , Datagridview


I want to disable the links to the child table based on condition ,

let say if filed OrderDate is empty at row in table Orders I want to disable link to OrderDetailes for that specific row

ASPX.vb data from dataset to textbox?


i want data from dataset display in textbox1 i did like this


Protected Sub Page_Load(ByVal sender As Object,

Which is better Dataset or Collections to bindata GridView


Hello Friends,

         I have a collection object in my project and I want to bind it to Grid View. I want to make this method as generic.

1. How can I bind a collection object to Grid View?

2. And please tell me which is the best method (Performance wise) to bind grid view? Is it through Dataset or Collection?

3. If its collection then why?

       Please help me guys.




Web.config and Sharepoint Designer 2007 aspx datasource


I have taken over a project that was developed in Sharepoint Designer 2007 with about 10 .aspx pages. The problem is that these pages have data sources embedded in them(inline). The datasources have explicit server/username/password information in them. So, when we want to move this from dev to test to prod I have to create the backup .cmp file from dev and restore it to test. However test is using a different database along with different login credentials so I have to manually change the datasource info.

So my question is, how can I create a variable in the web.config file to specify this datasource connection so it is not hard coded in the inline aspx page.

Remember these pages do NOT have code behind. They were developed in Sharepoint designer 2007 using the GUI.

I have tried adding a <key> or a <connectionStrings> item in the web.config file in hopes that the .aspx page would recognize it and problem solved. When I reference the item in the .aspx page as <%$ ConnectionStrings:dbname %> it just does not recognize it.

Please help, under some pressure here.

Selecting radio buttons in a gridview with dataset from Linq Query


Hi Everyone!

I've got a gridview that will allow clients to edit options they've already entered on another page.  The gridview has three radio buttons in it each with a value of 1,2,3.  The option value in the dataset is 1,2 or 3 respectively.  I would like to have the radiobutton with the corresponding value selected in the gridview so they can see what they previously chose and will then be able to edit, if they wish.

How do I do this? 

Here's my code so far:

Dim clientOption = (From c In dc.ClientOptions _
                                 Where c.clientID = userClientID _
                                 Select New With {c.clientOptionID, _
                                                  c.optionWording, _

            'Now Populate Gridview 1 with set options
            If clientOption Is Nothing Then
                Label1.Text = "There are currently no set options to edit."

                GridView1.DataSource = clientOption
                Label1.Text = "Edit set options."
            End If

            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="F

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