.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 bind GridView ???

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net


I have a Jquery which pops up an alert box in code behind as follows:


msg = "csscody.alert('<h1>Success</h1><br><p>Requests sent to Logistic Company</p>')"
ScriptManager.RegisterStartupScript(Button1, Button1.GetType, "alertscript", msg, True)


There is a button on this alert box and I would like to rebind a Gridview on this button click.How can I do it?

Thanks in advance.


Best Regards.

View Complete Post

More Related Resource Links

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

Change data on gridview bind


Hi there,

Simple little problem. i have a gridview that shows products assigned to a customers job. They are displayed in exVAT prices. To make it easier i want to show the inc VAT prices. How can i add VAT to 1 column in this table?

Bind List&lt;&gt; to GridView

Can any body help how to update list through gridview

Build chart bar with asp.net (bind from gridview)

Build chart bar with asp.net (bind from gridview)Please guide to there with vb code.

read delimited files into a datatable and bind to a gridview

I have a delimted file , like a csv file but the delimters are # and not ,I assume I would use SqlConnection and SqlDataAdapterSo for a csv file what is the sequence to read in for example c:\data\demo.csvWhat would the connection string be.Also can you specifiy a different delimiter.The code below is what I assume it would possibly look likea although its only a frst guess. ThanksJim Dim connectionString As String = "Data Source=localhost;Initial Catalog=master;Integrated Security=true;" Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("Northwind_ConnectionString").ConnectionString) Dim str As String = "SELECT * FROM Employees" Dim cmd As New SqlCommand(str, con) Dim da As New SqlDataAdapter(cmd) Dim dt As New DataTable() da.Fill(dt) GridView1.DataSource = dt GridView1.DataBind()

How to Bind Selective Columns from Stored Proc to Gridview using the entity framework


Hi Guys,

I have this entity model>> http://img840.imageshack.us/img840/306/schemaj.jpg and I would like to bind  a list  which consists of: employee's

  • emloyee_firstname(employees table) + employee_lastname(employees table)
  • employee's extension(employee_extension table)
  • deparment name(departments table)

to my gridview. I already created my stored procedure

    Concat(employees.employee_firstname," ",employees.employee_lastname) as name
    , extensions.extension_number
    , departments.department_description
    INNER JOIN employees 
        ON (employee_extensions.employee_id = employees.employee_id)
    INNER JOIN extensions 
        ON (employee_extensions.extension_id = extensions.extension_id)
    INNER JOIN departments 
        ON (employees.department_id = departments.department_id)

But my problem is, i don't know how to bind it since i don't have an entity that contains the employee's name, extension# and departments name. Do I need to create a custom class that consists of said columns? or is their a proper way to do this? I'

Bind listbox to gridview on client side



I have a list box (that uses a SQlDataSource) that has a list of jobs. I have a grid view (that also uses a SQLDataSource) that has the items used in each job. I want to bind the list box value to the gridview on the client side, i.e. when the user clicks on a different job in the list view I want the grid to show the items for that job.

Also, at formload I want the gridview to show the details of the first job on the listview.

Please let me know how I can do this in the aspx page.


- Sankaran

Bind a GridView to a DataTable (in Viewstate) with full in-line CRUD


Hello fellow devs!

I need a bit of help with a scenario. I am working on a web application that requires huge amounts of data to be Added, Deleted, and Updated. The data entry forms are divided into logical groups through Multiviews. All the information is saved when the mighty Finish button is pressed. The current setup (previous developer) does not allow me to use transactions. Therefore, if I am to save a new Courier to the database, I need to add his/her Distance and Rate info. In addition, I need to add his/her Banned Areas info (Area Name, Post Code).

This is where it gets interesting. Obviously, the DistamceAndRate table and the BannedArea table in my SQL Server will have the CourierID as a foreign key. Since I'm going to save the Courier as well as the Rates and Areas info in one go, I cannot have the newly created CourierID before. Therefore, I cannot bind my Grids for Distance + Rates and Banned Areas directly to database.
What I am doing is creating two DataTables and managing them in Viewstate through properties as follow:

        private DataTable TableDistancesAndRates {
            get {
                object objTableDistancesAndRates = ViewState["vTableDistancesAndRates"];

                if (objTableDistancesAndRates!=null) {
                    return (DataTable)objTableD

Gridview icw XMLDatasource :Databinding methods such as Eval(), XPath(), and Bind() can only be used


I want to get the value of an xpath expression in rowdatabound event. But I get:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

<asp:GridView ID="gvSearchResults"  AutoGenerateColumns="False" DataSourceID="XMLDS" runat="server">
    Rating:  <%# XPath("float[@name=""location_rating""]")%>

<asp:XmlDataSource EnableCaching="False" XPath="response/result/doc" ID="XMLDS" runat="server"></asp:XmlDataSource>

Protected Sub gvSearchResults_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSearchResults.RowDataBound
    Dim value As String = XPath("float[@name=""location_rating""]")
End Sub

Bind Gridview with JQuery


How can I bind my gridview with JQuery?

Please send me some sample code.

Or Is there any way to do this. I want to make a search like google instant search?


Thanks in advance

How to bind data to a gridview with in another grid view


I have inserted a grid view with in another gridview and iam facing problem in binding the data to GridView2 ...I tried row editing event by using FindControl() method..but stuck at that point what to do next..

And iam using EDM to refer database...

i have writeen code as below to get the contol values...

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        GridView1.EditIndex = e.NewEditIndex;

after that where should i pass these values so that i can bind the data to grid view...

Bind gridview column to nested object



not really sure how to phrase this question.

If I have a list of contacts List<Contact> and a Contact object has an Office object property, I want to display a grid with columns

Contact Id, First Name, Last Name, Office Name

Where the sources of the above columns are respectively:

Contact.ContactId, Contact.FirstName, Contact.LastName, Contact.Office.OfficeName

I'm fine with binding the first 3, but was wondering whether I can bind the OfficeName using either Bind or Eval or whether I need to hook into the events and set the value there.






how can bind file pdf in gridview


i hava a tow server the frist server name webserver and the second name is a file server

the frist server is public and hava a real IP but the second is an internal network

then i want some linkbutton when user click it open file in the second server (file server )

how can make it with secure

Bind Gridview into Email Message Body



      I have a gridview in a webpage. How can I convert into an EMail message body(of either a Textbox named Text Message). I want to mail this gridview to someone. Is there any simple way to do this.

      So can anybody please hel me in this regard.


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