I have embeded a C1WebGrid and bind to a table in an ASP.NET panel which will to popup when user click on a linked button from the parent C1WebGrid. I have 2 challenges as follow:
1. I am not able to execute the particular javascript from code-behind linked buttons inside the parent C1WebGrid.
2. The popup form with C1WebGrid always shows previous set of data and not refresh or show the new instance of data. Each time the code binds the table with new result the C1WebGrid showed previous data thus repeating columns. Is there a way to refresh or a way around it?
Thanks
<codeNinja> wrote: news:224322@10.0.1.98... I have embeded a C1WebGrid and bind to a table in an ASP.NET panel which will to popup when user click on a linked button from the parent C1WebGrid. I have 2 challenges as follow: 1. I am not able to execute the particular javascript from code-behind linked buttons inside the parent C1WebGrid. 2. The popup form with C1WebGrid always shows previous set of data and not refresh or show the new instance of data. Each time the code binds the table with new result the C1WebGrid showed previous data thus repeating columns. Is there a way to refresh or a way around it? Thanks http://helpcentral.componentone.com/cs/forums/p/81160/224322.aspx#224322
1. Calling Java script: fixed.. no longer need help.. please disregard.
2. Refresh WebGrid:
The webgrid on my the modal popup panel is not refereshing properly or rather showing old columns each time I bind the webgrid. So first click to bind the data the webgrid showed 4 columns, second click showed 8 columns (data or cell updated correctly), thrid click showed 12 columns and so forth. Each click of the linked button calls the binding_C1WebGrid2(e.Item.Cells(0).Text, e.Item.Cells(11).Text) from the Select Case e.CommandName code segment from example 1 provided above. Below is my binding method:
Private Sub binding_C1WebGrid2(ByVal AsmtDataID As Int64, ByVal AsmtName As String) Dim objConn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("AuthConnStr").ConnectionString) Try Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdapter("USE [mrspp.com] SELECT * FROM VersioningEvents WHERE AsmtDataID = '" & AsmtDataID & "' ORDER BY VersionDT DESC", objConn) sqlDataAdapter.Fill(AsmtNversionDS, "AsmtVersion") C1WebGrid2.DataSource = AsmtNversionDS.Tables("AsmtVersion") C1WebGrid2.AllowGrouping = False C1WebGrid2.AllowAutoSize = False C1WebGrid2.AllowSorting = False C1WebGrid2.AllowColMoving = False C1WebGrid2.AllowColSizing = True Me.lbl_asmt.Text = AsmtName & " - Assessment Version" Me.lbl_asmt.Width = 570 Me.lbl_asmt.Font.Bold = True 'AsmtDataID - bound Dim col0 As New C1.Web.C1WebGrid.C1BoundColumn col0.DataField = AsmtNversionDS.Tables("AsmtVersion").Columns("AsmtDataID").ToString() col0.HeaderText = "AsmtDataID" col0.SortExpression = "AsmtDataID" col0.ReadOnly = True col0.Visible = False C1WebGrid2.Columns.Add(col0) 'VersionDT - bound Dim col1 As New C1.Web.C1WebGrid.C1BoundColumn col1.DataField = AsmtNversionDS.Tables("AsmtVersion").Columns("VersionDT").ToString() col1.HeaderText = "Date/Time" col1.SortExpression = "VersionDT" col1.ReadOnly = False col1.Visible = True 'col1.AllowSizing = True C1WebGrid2.Columns.Add(col1) 'Version - bound Dim col2 As New C1.Web.C1WebGrid.C1BoundColumn col2.DataField = AsmtNversionDS.Tables("AsmtVersion").Columns("Version").ToString() col2.HeaderText = "Version" col2.SortExpression = "Version" col2.ReadOnly = True col2.Visible = True 'col2.AllowMove = True 'col2.AllowSizing = True C1WebGrid2.Columns.Add(col2) 'VersionedBy - bound Dim col3 As New C1.Web.C1WebGrid.C1BoundColumn col3.DataField = AsmtNversionDS.Tables("AsmtVersion").Columns("VersionedBy").ToString() col3.HeaderText = "Versioned By" col3.SortExpression = "VersionedBy" col3.ReadOnly = True col3.Visible = True 'col3.AllowMove = True 'col3.AllowSizing = True C1WebGrid2.Columns.Add(col3) 'Comment - bound Dim col4 As New C1.Web.C1WebGrid.C1BoundColumn col4.DataField = AsmtNversionDS.Tables("AsmtVersion").Columns("Comment").ToString() col4.HeaderText = "Comments" col4.SortExpression = "Comment" col4.ReadOnly = True col4.Visible = True col4.ItemStyle.Wrap = True 'col4.AllowMove = True 'col4.AllowSizing = True C1WebGrid2.Columns.Add(col4) C1WebGrid2.Columns(1).ItemStyle.Width = New Unit(150) C1WebGrid2.Columns(2).ItemStyle.Width = New Unit(50) C1WebGrid2.Columns(3).ItemStyle.Width = New Unit(100) C1WebGrid2.Columns(4).ItemStyle.Width = New Unit(300) C1WebGrid2.AlternatingItemStyle.BackColor = Color.FromArgb(0, 221, 221, 221) C1WebGrid2.DataBind() Catch e As Exception 'remove before release: MsgBox("ViewAsmt.binding_C1WebGrid2() error :" + e.ToString(), MsgBoxStyle.Critical, "Error Message") Finally objConn.Close() End Try End Sub
If you would like I can also email you my code file for reference if you providme me your email.