P
Peter Kamitz
hi,
i dont know whts wrong with this code, but the selected index changed event
isnt fired
I ve tried it with addHandler and with OnSelectedIndexChanged description in
HTML
what am i doing wrong?? please help!!
thanks peter
here is my vb code:
Public Class InvoiceCheck
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents MyGrid As C1.Web.C1WebGrid.C1WebGrid
Protected WithEvents EditPanel As System.Web.UI.WebControls.Panel
Protected WithEvents txtPresentation As System.Web.UI.WebControls.TextBox
Protected WithEvents txtStockDateStock As System.Web.UI.WebControls.TextBox
Protected WithEvents txtInvoiceNumber As System.Web.UI.WebControls.TextBox
Protected WithEvents txtInvoiceValue As System.Web.UI.WebControls.TextBox
Protected WithEvents txtValueAccrued As System.Web.UI.WebControls.TextBox
Protected WithEvents txtComment As System.Web.UI.WebControls.TextBox
Protected WithEvents ddCurrencyid As System.Web.UI.WebControls.DropDownList
Protected WithEvents Button_Update As System.Web.UI.WebControls.Button
Protected WithEvents Button_Cancel As System.Web.UI.WebControls.Button
Protected WithEvents GridPanel As System.Web.UI.WebControls.Panel
Protected WithEvents txtInvoiceUnits As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 Page.IsPostBack Then
Else
BindData()
AddHandler MyGrid.SelectedIndexChanged, AddressOf IndexChange_Command
End If
End Sub
Private Sub BindData()
SetGridStyles(MyGrid) 'Apply default Css Style Settings
ddCurrencyid.DataSource = GetCurrencies()
ddCurrencyid.DataValueField = "curr_id"
ddCurrencyid.DataTextField = "curr_code"
ddCurrencyid.DataBind()
MyGrid.DataSource = GetInvoiceData()
MyGrid.DataBind()
End Sub
Private Sub MyGrid_ItemCreated(ByVal sender As Object, ByVal e As
C1.Web.C1WebGrid.C1ItemEventArgs) Handles MyGrid.ItemCreated
If e.Item.ItemType = C1.Web.C1WebGrid.C1ListItemType.Item Then
e.Item.Attributes.Add("onmouseover",
"this.className='tableMouseoverColor';this.style.cursor='hand'")
e.Item.Attributes.Add("onmouseOut", "this.className='tableBgColor1Class';")
ElseIf e.Item.ItemType = C1.Web.C1WebGrid.C1ListItemType.AlternatingItem
Then
e.Item.Attributes.Add("onmouseover",
"this.className='tableMouseoverColor';this.style.cursor='hand'")
e.Item.Attributes.Add("onmouseOut", "this.className='tableBgColor2Class';")
End If
e.Item.Attributes.Add("onclick", "javascript:__doPostBack('" & "MyGrid:" &
"_ctl" & (e.Item.ItemIndex + 2) & ":_ctl0','')")
End Sub
Sub IndexChange_Command(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyGrid.SelectedIndexChanged
EditPanel.Visible = True
GridPanel.Visible = False
End Sub
Private Sub Button_Update_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button_Update.Click
EditPanel.Visible = False
GridPanel.Visible = True
End Sub
and here is my html code:
<%@ Page Language="vb" AutoEventWireup="False"
Codebehind="InvoiceCheck.aspx.vb" Inherits="Wyeth.Alf.InvoiceCheck"%>
<%@ Register TagPrefix="c1webgrid" Namespace="C1.Web.C1WebGrid"
Assembly="C1.Web.C1WebGrid, Version=1.1.20033.24, Culture=neutral,
PublicKeyToken=589f1fc067ff4031" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>InvoiceCheck</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="../Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp
anel id="GridPanel" style="Z-INDEX: 103; LEFT: 8px; POSITION:
absolute; TOP: 8px" runat="server"
Width="957" Height="653">
<C1WEBGRID:C1WEBGRID id="MyGrid" runat="server" Width="100%"
Height="100%" AutoGenerateColumns="False"
OnSelectedIndexChanged="IndexChange_Command">
<Columns>
<c1webgrid:C1BoundColumn DataField="PROD_PRESENTATION"
HeaderText="Presentation"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_DATE_STOCK"
HeaderText="Date"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_INVOICE_NUMBER"
HeaderText="Invoice Number"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_UNIT"
HeaderText="Units"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_INVOICE_VALUE"
HeaderText="Invoice Value"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_VALUE_ACCRUED"
HeaderText="Invoice Value TCOGS"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_COMMENT"
HeaderText="Comment"></c1webgrid:C1BoundColumn>
</Columns>
</C1WEBGRID:C1WEBGRID>
<asp
anel id="EditPanel" runat="server" Width="100%" Height="100%"
Visible="False">
<TABLE cellSpacing="0" cellPadding="2" width="100%" border="0">
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Presentation:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtPresentation" runat="server"
cssClass="formfield"></asp:TextBox></TD>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Date:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtStockDateStock" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Invoice Number:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceNumber" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Units:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceUnits" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Invoice Value:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceValue" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Invoice Value accrued:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtValueAccrued" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Comment:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtComment" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Invoice Currency</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp
ropDownList id="ddCurrencyid" runat="server"
cssClass="formfield"></asp
ropDownList>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD width="100%" colSpan="3">
<asp:Button id="Button_Update" runat="server" Text="Update"
CssClass="Button_common"></asp:Button>
<asp:Button id="Button_Cancel" runat="server" Text="Cancel"
CssClass="Button_common"></asp:Button></TD>
</TR>
</TABLE>
</asp
anel>
</asp
anel></form>
</body>
</HTML>
i dont know whts wrong with this code, but the selected index changed event
isnt fired
I ve tried it with addHandler and with OnSelectedIndexChanged description in
HTML
what am i doing wrong?? please help!!
thanks peter
here is my vb code:
Public Class InvoiceCheck
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents MyGrid As C1.Web.C1WebGrid.C1WebGrid
Protected WithEvents EditPanel As System.Web.UI.WebControls.Panel
Protected WithEvents txtPresentation As System.Web.UI.WebControls.TextBox
Protected WithEvents txtStockDateStock As System.Web.UI.WebControls.TextBox
Protected WithEvents txtInvoiceNumber As System.Web.UI.WebControls.TextBox
Protected WithEvents txtInvoiceValue As System.Web.UI.WebControls.TextBox
Protected WithEvents txtValueAccrued As System.Web.UI.WebControls.TextBox
Protected WithEvents txtComment As System.Web.UI.WebControls.TextBox
Protected WithEvents ddCurrencyid As System.Web.UI.WebControls.DropDownList
Protected WithEvents Button_Update As System.Web.UI.WebControls.Button
Protected WithEvents Button_Cancel As System.Web.UI.WebControls.Button
Protected WithEvents GridPanel As System.Web.UI.WebControls.Panel
Protected WithEvents txtInvoiceUnits As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 Page.IsPostBack Then
Else
BindData()
AddHandler MyGrid.SelectedIndexChanged, AddressOf IndexChange_Command
End If
End Sub
Private Sub BindData()
SetGridStyles(MyGrid) 'Apply default Css Style Settings
ddCurrencyid.DataSource = GetCurrencies()
ddCurrencyid.DataValueField = "curr_id"
ddCurrencyid.DataTextField = "curr_code"
ddCurrencyid.DataBind()
MyGrid.DataSource = GetInvoiceData()
MyGrid.DataBind()
End Sub
Private Sub MyGrid_ItemCreated(ByVal sender As Object, ByVal e As
C1.Web.C1WebGrid.C1ItemEventArgs) Handles MyGrid.ItemCreated
If e.Item.ItemType = C1.Web.C1WebGrid.C1ListItemType.Item Then
e.Item.Attributes.Add("onmouseover",
"this.className='tableMouseoverColor';this.style.cursor='hand'")
e.Item.Attributes.Add("onmouseOut", "this.className='tableBgColor1Class';")
ElseIf e.Item.ItemType = C1.Web.C1WebGrid.C1ListItemType.AlternatingItem
Then
e.Item.Attributes.Add("onmouseover",
"this.className='tableMouseoverColor';this.style.cursor='hand'")
e.Item.Attributes.Add("onmouseOut", "this.className='tableBgColor2Class';")
End If
e.Item.Attributes.Add("onclick", "javascript:__doPostBack('" & "MyGrid:" &
"_ctl" & (e.Item.ItemIndex + 2) & ":_ctl0','')")
End Sub
Sub IndexChange_Command(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyGrid.SelectedIndexChanged
EditPanel.Visible = True
GridPanel.Visible = False
End Sub
Private Sub Button_Update_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button_Update.Click
EditPanel.Visible = False
GridPanel.Visible = True
End Sub
and here is my html code:
<%@ Page Language="vb" AutoEventWireup="False"
Codebehind="InvoiceCheck.aspx.vb" Inherits="Wyeth.Alf.InvoiceCheck"%>
<%@ Register TagPrefix="c1webgrid" Namespace="C1.Web.C1WebGrid"
Assembly="C1.Web.C1WebGrid, Version=1.1.20033.24, Culture=neutral,
PublicKeyToken=589f1fc067ff4031" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>InvoiceCheck</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="../Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp
absolute; TOP: 8px" runat="server"
Width="957" Height="653">
<C1WEBGRID:C1WEBGRID id="MyGrid" runat="server" Width="100%"
Height="100%" AutoGenerateColumns="False"
OnSelectedIndexChanged="IndexChange_Command">
<Columns>
<c1webgrid:C1BoundColumn DataField="PROD_PRESENTATION"
HeaderText="Presentation"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_DATE_STOCK"
HeaderText="Date"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_INVOICE_NUMBER"
HeaderText="Invoice Number"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_UNIT"
HeaderText="Units"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_INVOICE_VALUE"
HeaderText="Invoice Value"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_VALUE_ACCRUED"
HeaderText="Invoice Value TCOGS"></c1webgrid:C1BoundColumn>
<c1webgrid:C1BoundColumn DataField="STOC_COMMENT"
HeaderText="Comment"></c1webgrid:C1BoundColumn>
</Columns>
</C1WEBGRID:C1WEBGRID>
<asp
Visible="False">
<TABLE cellSpacing="0" cellPadding="2" width="100%" border="0">
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Presentation:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtPresentation" runat="server"
cssClass="formfield"></asp:TextBox></TD>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Date:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtStockDateStock" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Invoice Number:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceNumber" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Units:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceUnits" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Invoice Value:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtInvoiceValue" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Invoice Value accrued:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtValueAccrued" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD class="field">Comment:</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp:TextBox id="txtComment" runat="server"
cssClass="formfield"></asp:TextBox>
<TR class="tableBgColor2Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor2Class';">
<TD class="field">Invoice Currency</TD>
<TD><IMG height="1" alt="" src="images/trans.gif" width="10"
border="0"></TD>
<TD width="100%">
<asp
cssClass="formfield"></asp
<TR class="tableBgColor1Class"
onmouseover="this.className='tableMouseoverColor';"
onmouseout="this.className='tableBgColor1Class';">
<TD width="100%" colSpan="3">
<asp:Button id="Button_Update" runat="server" Text="Update"
CssClass="Button_common"></asp:Button>
<asp:Button id="Button_Cancel" runat="server" Text="Cancel"
CssClass="Button_common"></asp:Button></TD>
</TR>
</TABLE>
</asp
</asp
</body>
</HTML>