Pages

Tuesday, February 23, 2010

AJAX rating control using in Gridview

While browsing for answers through various ASP.NET blogs and forums, I often come across certain topics which repeat in one way or another.

This article is an exercise which answers some common GridView questions. In particular, here I am dealing with:

  1. MS Access database connectivity.
  2. MS AjaxControlToolkit's Rating extender, which is put on every row allowing the user to rate each row in real time. In other words, as soon as the user rates the row (chooses the number of stars), an asynchronous (AJAX) call to the server is made and the database is updated.
  3. Data bound dropdownlists in each GridView row. Each row has a supplier, which is displayed in a dropdown list in order to facilitate record modification.
  4. JavaScript client-side row manipulation. In particular, on checkbox click, the Product textbox is locked/unlocked.





























Click here for details ....

Sorting gridview bound with datatable



Protected Sub gvSorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)

dtData = CType(Session("Data"), DataTable)
Dim dv As DataView = dtData.DefaultView
Dim sortdirection As String


If ViewState("direction") <> "" Then
sortdirection = ViewState("direction")
If sortdirection = "asc" Then
sortdirection = "desc"
Else
sortdirection = "asc"
End If
Else
sortdirection = "asc"
End If

dv.Sort = e.SortExpression + " " + sortdirection
dtData = dv.ToTable
ViewState("direction") = sd

gvwList.DataSource = dtData
gvwList.DataBind()


End Sub