Login  
Search All Forums
Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
AuthorForum: PowerWEB LiveControls for ASP.NET
Topic: Problem when adding rows to a datagrid.
chapmaaj

From: chilton, United Kingdom
Posts: 4
Member Since: 07/05/06
posted July 7, 2006 6:15 AM

I have a webpage with a live button and live datagrid. I use the live button to add a row to the live data grid.

I have a select button on the datagrid. WHen a press the button in the added row the select index chnaged and item command events do not fire.

If any one can help it would be much appriciated.

Thanks

version 1.5.1 (demo)
.net 1.0
VS 2002.

The code below demonstates the problem.

<%@ Register TagPrefix="cc1" Namespace="Dart.PowerWEB.LiveControls" Assembly="Dart.PowerWEB.LiveControls" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="testLiveDataGrid.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
<cc1:LiveDataGrid id="LiveDataGrid1" runat="server">
<Columns>
<cc1:LiveButtonColumn Text="Select" ButtonType="PushButton" ImageUrl="" CommandName="Select"></cc1:LiveButtonColumn>
</Columns>
</cc1:LiveDataGrid></P>
<P>
<cc1:LiveButton id="LiveButton1" runat="server"></cc1:LiveButton></P>
</form>
</body>
</HTML>





code behind

Public Class WebForm1
  Inherits System.Web.UI.Page
  Protected WithEvents LiveDataGrid1 As Dart.PowerWEB.LiveControls.LiveDataGrid
  Protected WithEvents LiveButton1 As Dart.PowerWEB.LiveControls.LiveButton

#Region " Web Form Designer Generated Code "

  'This call is required by the Web Form Designer.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

  End Sub

  Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
  End Sub

#End Region

  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If Not IsPostBack Then
      initdata()
      dobind()
    End If
  End Sub

  Sub dobind()
    Me.LiveDataGrid1.DataSource = Session("dt")
    Me.LiveDataGrid1.DataBind()
  End Sub

  Sub initdata()
    Dim dt As New DataTable("mytable")
    Dim r As DataRow
    dt.Columns.Add("col1")
    dt.Columns.Add("col2")
    r = dt.NewRow()
    r.Item(0) = "val1"
    r.Item(1) = "val2"
    dt.Rows.Add(r)
    r = dt.NewRow()
    r.Item(0) = "val3"
    r.Item(1) = "val4"
    dt.Rows.Add(r)
    dt.AcceptChanges()
    Session.Add("dt", dt)
  End Sub

  Private Sub LiveButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LiveButton1.Click
    Dim dt As DataTable
    Dim r As DataRow
    dt = Session("dt")
    r = dt.NewRow()
    r.Item(0) = Now.ToShortDateString
    r.Item(1) = Now.ToLongTimeString
    dt.Rows.Add(r)
    dobind()

  End Sub

  Private Sub LiveDataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles LiveDataGrid1.ItemCommand

  End Sub

  Private Sub LiveDataGrid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LiveDataGrid1.SelectedIndexChanged

  End Sub
End Class




Jeff Cranford



From: Rome, NY USA
Posts: 586
Member Since: 05/30/01
posted July 10, 2006 4:43 PM

Your code works fine with the latest (unreleased) code. We are planning on a LiveControls update within the next couple of weeks which should clear up your issue.
chapmaaj

From: chilton, United Kingdom
Posts: 4
Member Since: 07/05/06
posted July 11, 2006 3:54 AM

Thanks for that. If you could let me know when it is released please. I'm on a tight schedule!
chapmaaj

From: chilton, United Kingdom
Posts: 4
Member Since: 07/05/06
posted July 19, 2006 8:59 AM

I have just downloaded and installed the latest version of the live controls (1.5.2) and this does not work from me. Note that the first two buttons in the datagrid fire the item command event. It is only the button in the added row (3rd) that does not fire the event. If anyone could help please?
Jeff Cranford



From: Rome, NY USA
Posts: 586
Member Since: 05/30/01
posted July 24, 2006 9:26 AM

Hi Andy,

I see you have an open support issue related to this as well. I'll reply to you through that channel, and post any resolution here for others to see.
Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX