paging problem in editable datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shail

    #1

    paging problem in editable datagrid

    Hello every one

    I am using editable datagrid in my application. I set grid's allowpaging property to true. My application is not working properly. When I click on 'Edit' to modify any row, instead of making the row editable for user, PageIndexChange d event is fired and grid's current page is changed. When I click on next/previous page my current page is not chaning. Can any body help me what to do. My complete code is as under

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Loa
    'Put user code to initialize the page her
    loadgrid(
    If Not Page.IsPostBack The
    dgdata.CurrentP ageIndex =
    End I
    End Su

    Sub loadgrid() 'this sub is to create the grid at runtime
    Dim com As New SqlCommand(
    Dim da As New SqlDataAdapter( "select * from tblissue", mycon
    Dim ds As New DataSet(
    Dim dc As New BoundColumn(
    Dim ea As New EditCommandColu mn(
    Dim i As Int3

    da.Fill(ds, "tblissue"

    dgdata.AutoGene rateColumns = Fals
    dgdata.AllowPag ing = Tru
    dgdata.PagerSty le.Mode = PagerMode.NextP re

    dgdata.PageSize =

    dgdata.DataSour ce = ds.Tables("tbli ssue"
    ea.ButtonType = ButtonColumnTyp e.LinkButto
    ea.EditText = "edit
    ea.UpdateText = "update
    ea.CancelText = "cancel

    dgdata.Columns. Add(ea
    For i = 0 To ds.Tables("tbli ssue").Columns. Count -
    dc.DataField = ds.Tables("tbli ssue").Columns( i).ColumnNam
    dc.HeaderText = ds.Tables("tbli ssue").Columns( i).Captio
    dgdata.Columns. Add(dc
    If (ds.Tables("tbl issue").Columns (i).ColumnName = "solved") Or (ds.Tables("tbl issue").Columns (i).ColumnName = "expectedda te") Or (ds.Tables("tbl issue").Columns (i).ColumnName = "expectedti me") The
    dc.Visible = False 'to hide date/time colum
    End I
    If ds.Tables("tbli ssue").Columns( i).ColumnName = "issueid" Then dc.ReadOnly = True ' to lock ID colum
    dc = New BoundColumn(
    Nex
    dgdata.DataBind (
    End Su

    'following sub is called in pageindexchange d event fire
    Sub newpage(ByVal sender As Object, ByVal objArgs As DataGridPageCha ngedEventArgs
    dgdata.EditItem Index = -1
    dgdata.CurrentP ageIndex = objArgs.NewPage Inde
    End Su

    Sub editdg_EditComm and(ByVal source As Object, ByVal e As DataGridCommand EventArgs
    dgdata.EditItem Index = e.Item.ItemInde
    dgdata.DataBind (
    End Su

    Sub canceldg_Cancel Command(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles dgdata.CancelCo mman
    dgdata.EditItem Index = -
    dgdata.DataBind (
    End Su

    Plz guide m
    Shail.
Working...