Welcome Guest Search | Active Topics | Sign In | Register

CallbackPanel issue with ASP.NET GridView RowCommand Options
sunsethill
Posted: Wednesday, January 2, 2008 5:45:48 PM
Rank: Member
Groups: Member

Joined: 10/15/2007
Posts: 8
Hi,

I'm building a module that runs in a DotNetNuke portal.

I have two versions of the same page. The first version is using standard ASP.NET controls and the AJAX UpdatePanel and UpdateProgress controls.

This page is working OK - and can be viewed/tested here:

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses/mid/742/Default.aspx

The other version uses your Callback and Dialog controls. The controls are working OK - with the exception of handling the RowCommand method of the ASP.NET GridView control. If you try this page, you will see that the Callback and Dialog controls are working with the desired effect for standard operations - however, if you click on the edit or delete icons in the grid, the code for the RowCommand method does not appear to be firing. (to see how it should work - try the above link).

Here is the link to the module using the EO controls:

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses_New/mid/742/Default.aspx

I have my gridview control set as one of the triggers. Please let me know if I should be doing something different - or if you need more information.

Thanks in advance.
eo_support
Posted: Wednesday, January 2, 2008 5:59:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I see you are using an old build (2007.2.10). Can you try the new build (2007.2.19) that we recently sent to you? That way we can be on the same page. If the problem persists, please send a sample page to us and we will look into it as soon as possible.

Thanks
sunsethill
Posted: Thursday, January 3, 2008 6:30:05 AM
Rank: Member
Groups: Member

Joined: 10/15/2007
Posts: 8
Hi,

Thanks for the quick response. I have upgraded to the latest version - both on my development box - and at the site for the links I posted.

Here is the code in the RowCreated event of my GridView:

Code: Visual Basic.NET
Private Sub gridItems_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gridItems.RowCreated
            Try
                If e.Row.RowType = DataControlRowType.DataRow Then
                    Dim objButton As ImageButton = CType(e.Row.Cells(0).Controls(0), ImageButton)
                    objButton.CommandArgument = e.Row.RowIndex.ToString()
                End If
            Catch ex As Exception
                ShowError(ex)
            End Try
        End Sub


Here is the code in the RowCommand method:

Code: Visual Basic.NET
Private Sub gridItems_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridItems.RowCommand

            Try
                Dim strCommandName As String = e.CommandName.ToLower
                Select Case strCommandName
                    Case Is = "edititem"
                    Case Is = "deleteitem"
                    Case Else
                        'exit sub if code is being executed and the command name
                        'is something other than edititem or deleteitem
                        Exit Sub
                End Select

                Dim intIndex As Integer = Convert.ToInt32(e.CommandArgument)
                Dim gv As GridView = DirectCast(sender, GridView)
                Dim str0 As String = gv.DataKeyNames(0)
                ' set the selected row in the grid to the row that the edit or delete icon was clicked
                gv.SelectedIndex = intIndex

                Dim intItemID As Integer = CInt(gv.DataKeys(gv.SelectedIndex).Value)

                Select Case strCommandName

                    Case Is = "edititem"

                        Me.lblHidden.Text = intItemID.ToString
                        Me.lblHiddenMode.Text = "edit"
                        Call SetVisibility()
                        Call BindDetails(intItemID)

                    Case Is = "deleteitem"
                        Me.lblHidden.Text = intItemID.ToString
                        Me.lblConfirmDeletion.Text = "Are you sure you want to delete expense record <b>" & Me.lblHidden.Text & "</b>?"
                        Me.lblHiddenMode.Text = "confirmdelete"
                        Call SetVisibility()

                End Select
            Catch ex As Exception
                ShowError(ex)
            End Try

        End Sub


And here is the aspx page that corresponds with this link :

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses_New/mid/742/Default.aspx

Code: HTML/ASPX
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Expenses_New.ascx.vb" Inherits="SunsetHill.Modules.Accounting.Expenses_New" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
Espenses-New
<eo:CallbackPanel ID="CallbackPanel1" runat="server" Width="700px" LoadingDialogID="dlgProcessing" 
    Triggers="{ControlID:txtGSTAmount;Parameter:},{ControlID:lstCurrency;Parameter:U.S. Dollar},
    {ControlID:lstCurrency;Parameter:Australian Dollar},{ControlID:cmdDelete;Parameter:},
    {ControlID:cmdCancel;Parameter:},{ControlID:cmdCancelDeletion1;Parameter:},
    {ControlID:cmdConfirmDeletion1;Parameter:},{ControlID:cmdDelete;Parameter:},
    {ControlID:cmdExit;Parameter:},{ControlID:cmdAddExpense;Parameter:},
    {ControlID:txtAmount;Parameter:},{ControlID:gridItems;Parameter:}">

		<table id="tableMain" runat="server" width="700">
			<tr id="trList" runat="server">
				<td>
					<table width="100%">
							<tr>
								<td>
								</td>
							</tr>
							<tr>
								<td>
								</td>
							</tr>
							<tr>
								<td>
									<asp:GridView ID="gridItems" runat="server" AllowPaging="true"  AllowSorting="true" PageSize="12" AutoGenerateColumns="False" 
									ShowFooter="True" Caption="b>" CellPadding="3" 
									EmptyDataText="No records found for selection criteria ..." PagerSettings-Mode="NumericFirstLast" 
									datakeynames="ExpenseID"  
									FooterStyle-BackColor="#707070" 
									FooterStyle-ForeColor="#E0E0E0">
								    <AlternatingRowStyle BackColor="#E0E0E0" />
								    <HeaderStyle BackColor="transparent" ForeColor="#DE6143" />
                                                                        
										<columns>
											<asp:ButtonField ButtonType="Image" CommandName="EditItem" ImageUrl="~/images/edit.gif" HeaderStyle-Width="50" HeaderStyle-Height="25" HeaderText="Edit" ItemStyle-HorizontalAlign="Center" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" />
											<asp:BoundField DataField="ExpenseID" Visible="false"/>
											<asp:TemplateField HeaderText="ID" SortExpression="ExpenseID" HeaderStyle-Width="35" HeaderStyle-Height="25" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Center">
												<itemtemplate>
													<asp:Label id="lblGridExpenseID" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "ExpenseID", "{0:####}")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Date" SortExpression="DateDT" HeaderStyle-Width="125" HeaderStyle-Height="25" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Center">
												<itemtemplate>
													<asp:Label id="lblGridDateDT" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "DateDT", "{0:dd-MMM-yyyy}")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Vendor Name" SortExpression="VendorNameVC" HeaderStyle-Height="25" HeaderStyle-Width="300" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Left">
												<itemtemplate>
													<asp:Label id="lblGridVendorNameVC" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "VendorNameVC")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Net Amount" SortExpression="NetAmountMN" HeaderStyle-Height="25" HeaderStyle-Width="110" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Right">
												<itemtemplate>
													<asp:Label id="lblGridNetAmountMN" runat="server" class="ssh_ListItem">
														<%#CType(DataBinder.Eval(Container.DataItem, "NetAmountMN", "{0:c}"), Decimal)%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:ButtonField ButtonType="Image" CommandName="DeleteItem" ImageUrl="~/images/delete.gif" HeaderStyle-Width="50" HeaderText="Delete" ItemStyle-HorizontalAlign="Center" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" HeaderStyle-Height="25" />
										</columns>
									</asp:GridView>
								</td>
							</tr>
							<tr>
							<td>
							<table width="100%">
							<tr>
							<td align="right" width="500">
                                <asp:Label ID="lblTotal" CssClass="ssh_TotalExpenseLabel" runat="server" Text="Total Expenses:  "></asp:Label>
							</td>
							<td align="center">
                                <asp:Label ID="lblTotalExpenses" CssClass="ssh_TotalExpenses" runat="server" Text="111"></asp:Label>
							</td>
							</tr>
							</table>
							</td>
							</tr>
							<tr>
								<td align="center">
                                    <asp:ImageButton ID="cmdAddExpense" CausesValidation="False" runat="server" ToolTip="Add New Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_pen_colotrful_64.gif" OnClick="cmdAddExpense_Click"/>
                                                        
                                </td>
							</tr>
						</table>
				</td>
			</tr>
			<tr id="trDetails" runat="server">
				<td>
					<table width="100%" summary="layout table">
					        <tr>
											<td style="width: 200px">
                                                </td>
											<td>
                                                 </td>
										</tr>
					        <tr id="trExpenseID" runat="server">
								<td style="width: 200px">
										<dnn:Label ID="plExpenseID" cssclass="ssh_RegularLabel" runat="server" />
									</td>
									<td>
									    <asp:textbox id="txtExpenseID" cssclass="ssh_ReadOnlyTextBox" ReadOnly="true" runat="server" width="50" maxlength="6" TabIndex="10"></asp:textbox>
							        </td>
							</tr>
							<tr>
								<td width="200" valign="middle">
										<dnn:Label ID="plDate" cssclass="ssh_RegularLabel" runat="server" />
									</td>
									<td>
                                                <eo:DatePicker ID="cboDateEdit" runat="server" ControlSkinID="None" DayCellHeight="16"
                                                    DayCellWidth="19" DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True"
                                                    SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                                                    VisibleDate="2008-01-01" AllowMultiSelect="False">
                                                    <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                                                    <PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
                                                    <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                                                    <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                                                    <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                                                    <TitleArrowStyle CssText="cursor:hand" />
                                                    <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                                                    <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
                                                    <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                                                    <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                                                    <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
                                                    <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                                                </eo:DatePicker>
                                      </td>
							</tr>
									<tr>
										<td style="width: 200px">
											<dnn:label id="plVendorName" cssclass="ssh_RegularLabel" runat="server" controlname="txtVendorName" suffix=":"></dnn:label>
										</td>
										<td>
											<asp:TextBox ID="txtVendorName" cssclass="ssh_TextBox" runat="server" Width="300px" MaxLength="100" TabIndex="30"></asp:TextBox>
											<asp:RequiredFieldValidator ID="validatorVendorName" runat="server" ErrorMessage="Payee Name is Required !" ControlToValidate="txtVendorName" Display="Dynamic" SetFocusOnError="True">*</asp:RequiredFieldValidator>
										</td>
									</tr>
									<tr>
									</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plInvoiceNo" cssclass="ssh_RegularLabel" runat="server" controlname="txtInvoiceNo" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:TextBox ID="txtInvoiceNo" cssclass="ssh_TextBox" runat="server" Width="150px" MaxLength="50" TabIndex="40"></asp:TextBox> 
											</td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plExpenseCategory" cssclass="ssh_RegularLabel" runat="server" controlname="lstExpenseCategory" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:DropDownList ID="lstExpenseCategory" cssclass="ssh_TextBox" runat="server" Width="300px" TabIndex="50">
												</asp:DropDownList>
												<asp:CompareValidator ID="validateExpenseCategory" runat="server" ControlToValidate="lstExpenseCategory" Display="Dynamic" ErrorMessage="Please select an expense category !" Operator="NotEqual" ValueToCompare="0" Type="Integer">*</asp:CompareValidator></td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plAmount" runat="server" cssclass="ssh_RegularLabel" controlname="txtAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                               <asp:TextBox ID="txtAmount" runat="server" CssClass="ssh_TextBox" AutoPostBack="True" OnTextChanged="txtAmount_TextChanged" TabIndex="60"></asp:TextBox>
                                                <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Amount must be a number !" ControlToValidate="txtAmount" Operator="DataTypeCheck" Type="Double">*</asp:CompareValidator>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAmount"
                                                    ErrorMessage="Amount is Required !">*</asp:RequiredFieldValidator> 
                                             
                                             </td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plGSTAmount" cssclass="ssh_RegularLabel" runat="server" controlname="txtGSTAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtGSTAmount" runat="server" cssclass="ssh_TextBox" AutoPostBack="True" OnTextChanged="txtGSTAmount_TextChanged" TabIndex="70"></asp:TextBox>
                                                <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="GST Amount must be a number !" ControlToValidate="txtGSTAmount" Operator="DataTypeCheck" Type="Double">*</asp:CompareValidator>
                                               
                                                </td>
										</tr>
										<tr>
											<td style="width: 200px">
											</td>
											<td>
                                                 </td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plCurrency" cssclass="ssh_RegularLabel" runat="server" controlname="lstCurrency" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:DropDownList ID="lstCurrency" cssclass="ssh_TextBox" runat="server" Width="300px" AutoPostBack="True" OnSelectedIndexChanged="lstCurrency_SelectedIndexChanged" TabIndex="80">
												</asp:DropDownList> 
												<asp:Label ID="Label3" runat="server" CssClass="ssh_RequiredField" Text="*"></asp:Label> 
												<asp:CompareValidator ID="validateCurrency" runat="server" ControlToValidate="lstCurrency" Display="Dynamic" ErrorMessage="Please select an expense category !" Operator="NotEqual" ValueToCompare="0" Type="Integer">*</asp:CompareValidator></td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plExchangeRate" cssclass="ssh_RegularLabel" runat="server" controlname="txtExchangeRate" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtExchangeRate" runat="server" cssclass="ssh_ReadOnlyTextBox" ReadOnly="True"></asp:TextBox></td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:label id="plNetAmount" cssclass="ssh_RegularLabel" runat="server" controlname="txtNetAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtNetAmount" runat="server" cssclass="ssh_ReadOnlyTextBox" ReadOnly="True"></asp:TextBox></td>
										</tr>
										<tr>
											<td style="width: 200px">
												<dnn:Label ID="plDescription" cssclass="ssh_RegularLabel" runat="server" />
											</td>
											<td>
												<asp:TextBox ID="txtDescription" cssclass="ssh_TextBox" runat="server" Width="500px" MaxLength="250" Rows="3" TextMode="MultiLine" TabIndex="90"></asp:TextBox>   
											</td>
										</tr>
										<tr>
											<td colspan="2">
												<table style="width: 100%" cellspacing="5" summary="layout table">
													<tr>
														<td style="width: 33%" align="right">
															<asp:ImageButton ID="cmdSave" runat="server" ToolTip="Save Record" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_save1_64.gif" OnClick="cmdSave_Click1"/>
                                                        </td>
														<td width="33%" align="center">
															<asp:ImageButton ID="cmdDelete" runat="server" ToolTip="Delete Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_trash_64.gif" OnClick="cmdDelete_Click1" CausesValidation="False"/>
                                                        </td>
														<td width="33%" align="left">
															<asp:ImageButton ID="cmdCancel" CausesValidation="False" runat="server" ToolTip="Cancel and Return" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_return_64.gif" OnClick="cmdCancel_Click1"/>
                                                        </td>
													</tr>
												</table>
											</td>
										</tr>
						</table>
					
				</td>
			</tr>
			<tr id="trConfirmation" runat="server">
				<td>
							<table width="100%" summary="layout table">
									<tr>
										<td><img src='<%= ResolveUrl("Images/ssh_confirm.jpg") %>' border="0">
										</td>
										<td>
										<table width="100%">
										    <tr>
										    <td colspan="2" height="50" valign="middle">
										    <asp:Label ID="lblConfirmationHeader" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label></td>
									        </tr>
									        <tr>
										    <td colspan="2" style="height: 37px">
											    <asp:Label ID="lblConfirmationDetail" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label></td>
									        </tr>
									        <tr>
										    <td align="right">
											    <asp:Button ID="cmdAddAnother" runat="server" CssClass="StandardButton" Text="Add a new Expense" width="200" OnClick="cmdAddAnother_Click" /></td>
										    <td align="left">
											    <asp:Button ID="cmdExit" runat="server" CssClass="StandardButton" Text="Return to Expense View" width="200" OnClick="cmdExit_Click" /></td>
									        </tr>
										 </table>   
										</td>
									</tr>
		    				</table>
				</td>
			</tr>
			<tr id="trError" runat="server">
			<td>
			<p>
                <asp:TextBox ID="txtError" runat="server" ReadOnly="True" Rows="15" TextMode="MultiLine" Width="695px"></asp:TextBox>
                </p>
                <p>
                <asp:LinkButton ID="lnkReturnFromError" runat="server" OnClick="lnkReturnFromError_Click">Return</asp:LinkButton> 
                </p>
                </td>
			</tr>
			<tr id="trConfirmDeletion" runat="server">
			   <td>
				<table width="100%" summary="layout table">
					<tr>
					<td width="135" align="center">
					    <img src="<%= ResolveUrl("Images/ssh_confirmdelete.gif") %>" alt="" />
                        </td>
					<td width="350">
						<table width="100%">
						    <tr>
						    <td colspan="2" height="50" valign="middle">
						        <asp:Label ID="lblConfirmDeletion" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label>
						    </td>
					        </tr>
							<tr>
							<td align="center" width="175">
                               <asp:ImageButton ID="cmdConfirmDeletion1" runat="server" ToolTip="Delete Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_trash_64.gif"
                                        CausesValidation="False" OnClick="cmdConfirmDeletion1_Click"/>
					    	</td>
						    <td align="center" width="175">
						    <asp:ImageButton ID="cmdCancelDeletion1" CausesValidation="False" runat="server" ToolTip="Cancel and Return" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_return_64.gif" OnClick="cmdCancelDeletion1_Click"/>
						   
						    </td>
						    </tr>
						</table>   
					</td>
				</tr>
		</table>
	</td>
	</tr>
</table>
			
</eo:CallbackPanel>	
<eo:Dialog runat="server" id="dlgProcessing" BackColor="white" BorderWidth="1" BorderColor="Aqua" BackShadeColor="BurlyWood" BackShadeOpacity="30">
	<ContentTemplate>
		<table border="0" width="250">
			<tr>
				<td align="center">
					<img src="<%= ResolveUrl("Images/loading.gif") %>" />
				</td>
			</tr>
			<tr>
				<td align="center">Please wait...</td>
			</tr>
		</table>
	</ContentTemplate>
</eo:Dialog>	
		
<asp:Label ID="lblHidden" runat="server" Visible="False"></asp:Label>
<asp:Label ID="lblHiddenMode" runat="server" Text="browse" Visible="False"></asp:Label>


Here is the aspx page that just uses the standard AJAX and ASP.NET controls that corresponds with this page:

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses/mid/742/Default.aspx

Code: HTML/ASPX
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Expenses.ascx.vb" Inherits="SunsetHill.Modules.Accounting.Expenses" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<asp:UpdatePanel ID="updateAJAXPanel" runat="server">
	<contenttemplate>
		<table id="tableMain" runat="server" width="700">
			<tr id="trList" runat="server">
				<td>
					<table width="100%">
							<tr>
								<td>
								</td>
							</tr>
							<tr>
								<td>
								</td>
							</tr>
							<tr>
								<td>
									<asp:GridView ID="gridItems" runat="server" AllowPaging="true"  AllowSorting="true" PageSize="12" AutoGenerateColumns="False" 
									ShowFooter="True" Caption="b>" CellPadding="3" 
									EmptyDataText="No records found for selection criteria ..." PagerSettings-Mode="NumericFirstLast" 
									datakeynames="ExpenseID"  
									FooterStyle-BackColor="#707070" 
									FooterStyle-ForeColor="#E0E0E0">
								    <AlternatingRowStyle BackColor="#E0E0E0" />
								    <HeaderStyle BackColor="transparent" ForeColor="#DE6143" />
                                                                        
										<columns>
											<asp:ButtonField ButtonType="Image" CommandName="EditItem" ImageUrl="~/images/edit.gif" HeaderStyle-Width="50" HeaderStyle-Height="25" HeaderText="Edit" ItemStyle-HorizontalAlign="Center" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" />
											<asp:BoundField DataField="ExpenseID" Visible="false"/>
											<asp:TemplateField HeaderText="ID" SortExpression="ExpenseID" HeaderStyle-Width="35" HeaderStyle-Height="25" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Center">
												<itemtemplate>
													<asp:Label id="lblGridExpenseID" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "ExpenseID", "{0:####}")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Date" SortExpression="DateDT" HeaderStyle-Width="125" HeaderStyle-Height="25" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Center">
												<itemtemplate>
													<asp:Label id="lblGridDateDT" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "DateDT", "{0:dd-MMM-yyyy}")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Vendor Name" SortExpression="VendorNameVC" HeaderStyle-Height="25" HeaderStyle-Width="300" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Left">
												<itemtemplate>
													<asp:Label id="lblGridVendorNameVC" runat="server" class="ssh_ListItem">
														<%#DataBinder.Eval(Container.DataItem, "VendorNameVC")%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:TemplateField HeaderText="Net Amount" SortExpression="NetAmountMN" HeaderStyle-Height="25" HeaderStyle-Width="110" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" ItemStyle-HorizontalAlign="Right">
												<itemtemplate>
													<asp:Label id="lblGridNetAmountMN" runat="server" class="ssh_ListItem">
														<%#CType(DataBinder.Eval(Container.DataItem, "NetAmountMN", "{0:c}"), Decimal)%>
													</asp:Label>
												</itemtemplate>
											</asp:TemplateField>
											<asp:ButtonField ButtonType="Image" CommandName="DeleteItem" ImageUrl="~/images/delete.gif" HeaderStyle-Width="50" HeaderText="Delete" ItemStyle-HorizontalAlign="Center" HeaderStyle-CssClass="ssh_ListColumnHeader" HeaderStyle-BackColor="Transparent" HeaderStyle-Height="25" />
										</columns>
									</asp:GridView>
								</td>
							</tr>
							<tr>
							<td>
							<table width="100%">
							<tr>
							<td align="right" width="500">
                                <asp:Label ID="lblTotal" CssClass="ssh_TotalExpenseLabel" runat="server" Text="Total Expenses:  "></asp:Label>
							</td>
							<td align="center">
                                <asp:Label ID="lblTotalExpenses" CssClass="ssh_TotalExpenses" runat="server" Text="111"></asp:Label>
							</td>
							</tr>
							</table>
							</td>
							</tr>
							<tr>
								<td align="center">
                                    <asp:ImageButton ID="cmdAddExpense" CausesValidation="False" runat="server" ToolTip="Add New Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_pen_colotrful_64.gif" OnClick="cmdAddExpense_Click"/>
                                                        
                                </td>
							</tr>
						</table>
				</td>
			</tr>
			<tr id="trDetails" runat="server">
				<td>
					<table width="100%" summary="layout table">
					        <tr id="trExpenseID" runat="server">
								<td width="190">
										<dnn:Label ID="plExpenseID" cssclass="ssh_RegularLabel" runat="server" />
									</td>
									<td>
									    <asp:textbox id="txtExpenseID" cssclass="ssh_ReadOnlyTextBox" ReadOnly="true" runat="server" width="50" maxlength="6" TabIndex="10"></asp:textbox>
							        </td>
							</tr>
							<tr>
								<td width="190">
										<dnn:Label ID="plDate" cssclass="ssh_RegularLabel" runat="server" />
									</td>
									<td>
									<asp:textbox id="txtDate" cssclass="ssh_TextBox" runat="server" width="150" maxlength="15" AutoPostBack="True" OnTextChanged="txtDate_TextChanged" TabIndex="20"></asp:textbox>
							        <asp:hyperlink id="cmdCalendar" cssclass="CommandButton" runat="server" resourcekey="Calendar">Calendar</asp:hyperlink>
							        <asp:requiredfieldvalidator id="valStartDateRequired" runat="server" cssclass="NormalRed" resourcekey="valStartDateRequired.ErrorMessage" errormessage="Date Is Required" controltovalidate="txtDate">*</asp:requiredfieldvalidator>
							        <asp:comparevalidator id="valStartDate" cssclass="NormalRed" runat="server" controltovalidate="txtDate"
								        errormessage="Invalid Start date!" operator="DataTypeCheck" type="Date" ResourceKey="valStartDate.ErrorMessage">*</asp:comparevalidator>

                                       </td>
							</tr>
									<tr>
										<td>
											<dnn:label id="plVendorName" cssclass="ssh_RegularLabel" runat="server" controlname="txtVendorName" suffix=":"></dnn:label>
										</td>
										<td>
											<asp:TextBox ID="txtVendorName" cssclass="ssh_TextBox" runat="server" Width="300px" MaxLength="100" TabIndex="30" AutoCompleteType="Company"></asp:TextBox>
											<asp:RequiredFieldValidator ID="validatorVendorName" runat="server" ErrorMessage="Payee Name is Required !" ControlToValidate="txtVendorName" Display="Dynamic" SetFocusOnError="True">*</asp:RequiredFieldValidator>
										</td>
									</tr>
									<tr>
									</tr>
										<tr>
											<td>
												<dnn:label id="plInvoiceNo" cssclass="ssh_RegularLabel" runat="server" controlname="txtInvoiceNo" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:TextBox ID="txtInvoiceNo" cssclass="ssh_TextBox" runat="server" Width="150px" MaxLength="50" TabIndex="40"></asp:TextBox> 
											</td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plExpenseCategory" cssclass="ssh_RegularLabel" runat="server" controlname="lstExpenseCategory" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:DropDownList ID="lstExpenseCategory" cssclass="ssh_TextBox" runat="server" Width="300px" TabIndex="50">
												</asp:DropDownList>
												<asp:CompareValidator ID="validateExpenseCategory" runat="server" ControlToValidate="lstExpenseCategory" Display="Dynamic" ErrorMessage="Please select an expense category !" Operator="NotEqual" ValueToCompare="0" Type="Integer">*</asp:CompareValidator></td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plAmount" runat="server" cssclass="ssh_RegularLabel" controlname="txtAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtAmount" runat="server" CssClass="ssh_TextBox" AutoPostBack="True" OnTextChanged="txtAmount_TextChanged" TabIndex="60"></asp:TextBox>
                                                <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Amount must be a number !" ControlToValidate="txtAmount" Operator="DataTypeCheck" Type="Double">*</asp:CompareValidator>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAmount"
                                                    ErrorMessage="Amount is Required !">*</asp:RequiredFieldValidator> 
                                             
                                             </td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plGSTAmount" cssclass="ssh_RegularLabel" runat="server" controlname="txtGSTAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtGSTAmount" runat="server" cssclass="ssh_TextBox" AutoPostBack="True" OnTextChanged="txtGSTAmount_TextChanged" TabIndex="70"></asp:TextBox>
                                                <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="GST Amount must be a number !" ControlToValidate="txtGSTAmount" Operator="DataTypeCheck" Type="Double">*</asp:CompareValidator>
                                               
                                                </td>
										</tr>
										<tr>
											<td>
											</td>
											<td>
                                                 </td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plCurrency" cssclass="ssh_RegularLabel" runat="server" controlname="lstCurrency" suffix=":"></dnn:label>
											</td>
											<td>
												<asp:DropDownList ID="lstCurrency" cssclass="ssh_TextBox" runat="server" Width="300px" AutoPostBack="True" OnSelectedIndexChanged="lstCurrency_SelectedIndexChanged" TabIndex="80">
												</asp:DropDownList> 
												<asp:Label ID="Label3" runat="server" CssClass="ssh_RequiredField" Text="*"></asp:Label> 
												<asp:CompareValidator ID="validateCurrency" runat="server" ControlToValidate="lstCurrency" Display="Dynamic" ErrorMessage="Please select an expense category !" Operator="NotEqual" ValueToCompare="0" Type="Integer">*</asp:CompareValidator></td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plExchangeRate" cssclass="ssh_RegularLabel" runat="server" controlname="txtExchangeRate" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtExchangeRate" runat="server" cssclass="ssh_ReadOnlyTextBox" ReadOnly="True"></asp:TextBox></td>
										</tr>
										<tr>
											<td>
												<dnn:label id="plNetAmount" cssclass="ssh_RegularLabel" runat="server" controlname="txtNetAmount" suffix=":"></dnn:label>
											</td>
											<td>
                                                <asp:TextBox ID="txtNetAmount" runat="server" cssclass="ssh_ReadOnlyTextBox" ReadOnly="True"></asp:TextBox></td>
										</tr>
										<tr>
											<td width="200">
												<dnn:Label ID="plDescription" cssclass="ssh_RegularLabel" runat="server" />
											</td>
											<td>
												<asp:TextBox ID="txtDescription" cssclass="ssh_TextBox" runat="server" Width="500px" MaxLength="250" Rows="3" TextMode="MultiLine" TabIndex="90"></asp:TextBox>   
											</td>
										</tr>
										<tr>
											<td colspan="2">
												<table style="width: 100%" cellspacing="5" summary="layout table">
													<tr>
														<td style="width: 33%" align="right">
															<asp:ImageButton ID="cmdSave" runat="server" ToolTip="Save Record" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_save1_64.gif" OnClick="cmdSave_Click1"/>
                                                        </td>
														<td width="33%" align="center">
															<asp:ImageButton ID="cmdDelete" runat="server" ToolTip="Delete Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_trash_64.gif" OnClick="cmdDelete_Click1" CausesValidation="False"/>
                                                        </td>
														<td width="33%" align="left">
															<asp:ImageButton ID="cmdCancel" CausesValidation="False" runat="server" ToolTip="Cancel and Return" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_return_64.gif" OnClick="cmdCancel_Click1"/>
                                                        </td>
													</tr>
												</table>
											</td>
										</tr>
						</table>
					
				</td>
			</tr>
			<tr id="trConfirmation" runat="server">
				<td>
							<table width="100%" summary="layout table">
									<tr>
										<td><img src='<%= ResolveUrl("Images/ssh_confirm.jpg") %>' border="0">
										</td>
										<td>
										<table width="100%">
										    <tr>
										    <td colspan="2" height="50" valign="middle">
										    <asp:Label ID="lblConfirmationHeader" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label></td>
									        </tr>
									        <tr>
										    <td colspan="2" style="height: 37px">
											    <asp:Label ID="lblConfirmationDetail" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label></td>
									        </tr>
									        <tr>
										    <td align="right">
											    <asp:Button ID="cmdAddAnother" runat="server" CssClass="StandardButton" Text="Add a new Expense" width="200" OnClick="cmdAddAnother_Click" /></td>
										    <td align="left">
											    <asp:Button ID="cmdExit" runat="server" CssClass="StandardButton" Text="Return to Expense View" width="200" OnClick="cmdExit_Click" /></td>
									        </tr>
										 </table>   
										</td>
									</tr>
		    				</table>
				</td>
			</tr>
			<tr id="trError" runat="server">
			<td>
			An Error has occured.</br>
                <asp:TextBox ID="txtError" runat="server" ReadOnly="True" Rows="15" TextMode="MultiLine" Width="695px"></asp:TextBox>
                </br>
                <asp:LinkButton ID="lnkReturnFromError" runat="server" OnClick="lnkReturnFromError_Click">Return</asp:LinkButton> 
                </td>
			</tr>
			<tr id="trConfirmDeletion" runat="server">
			   <td>
				<table width="100%" summary="layout table">
					<tr>
					<td width="135" align="center">
					    <img src="<%= ResolveUrl("Images/ssh_confirmdelete.gif") %>" alt="" />
                        </td>
					<td width="350">
						<table width="100%">
						    <tr>
						    <td colspan="2" height="50" valign="middle">
						        <asp:Label ID="lblConfirmDeletion" CssClass="ssh_ListHeader" runat="server" Text="Label"></asp:Label>
						    </td>
					        </tr>
							<tr>
							<td align="center" width="175">
                               <asp:ImageButton ID="cmdConfirmDeletion1" runat="server" ToolTip="Delete Expense" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_trash_64.gif"
                                        CausesValidation="False" OnClick="cmdConfirmDeletion1_Click"/>
					    	</td>
						    <td align="center" width="175">
						    <asp:ImageButton ID="cmdCancelDeletion1" CausesValidation="False" runat="server" ToolTip="Cancel and Return" ImageUrl="~/DesktopModules/SunsetHill_Accounting/images/ssh_return_64.gif" OnClick="cmdCancelDeletion1_Click"/>
						   
						    </td>
						    </tr>
						</table>   
					</td>
				</tr>
		</table>
	</td>
	</tr>
</table>
				
	</contenttemplate>
	</asp:UpdatePanel>
	<table width="700" >
			<tr valign="middle">
				<td align="center">
					<asp:UpdateProgress ID="UpdateProgress2" runat="server">
					    <progresstemplate>
							    <img src="<%= ResolveUrl("Images/load.gif") %>" alt="" />
							    <asp:Label ID="lblProcessing" runat="server" CssClass="ssh_ProgressText" Text="Processing - please wait ..."></asp:Label>
					    </progresstemplate>
					</asp:UpdateProgress>
				</td>
			</tr>
	</table>
		
<asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="BulletList" ShowMessageBox="True" ShowSummary="False" HeaderText="Please correct the following errors:" />
<asp:Label ID="lblHidden" runat="server" Visible="False"></asp:Label>
<asp:Label ID="lblHiddenMode" runat="server" Text="browse" Visible="False"></asp:Label>


Please let me know if I can be of further assistance. Thanks.
eo_support
Posted: Thursday, January 3, 2008 10:33:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We tested in our environment and verified that ItemCommand works fine with CallbackPanel. However we are unable to run your code since your code relies on other class that we don't have. Thus you may want to start from a simple page or create a sample page that we can load and run here to demonstrate the problem.

Your RowCreate event shouldn't matter in this context. It only changes the image button's CommandArgument, which should not affect whether ItemCommand event fires.

Thanks
sunsethill
Posted: Thursday, January 3, 2008 5:52:33 PM
Rank: Member
Groups: Member

Joined: 10/15/2007
Posts: 8
Hi, I have created a web app with one page -basically the same code as the user control without the database calls - that has the same issue as earlier reported. The zip file can be downloaded here.

http://www.ldswebhost.com/eo/webapplication3.zip

Just unzip it to your PC and run the app - and try clicking on the edit or delete icons in one of the rows in the Grid.

This web app does not execute the code in the RowCommand event of the GridView - the same as is illustrated here:

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses_New/mid/742/Default.aspx


The version that does work - (i.e. the RowCommand code executed) - with the exact same code in the code-behind file - but using the standard AJAX UpdatePanel and UpdateProgress controls in the ASCX page - can be seen here:

http://www.sunsethill.ca/Home/ModuleTest/tabid/295/ctl/Expenses/mid/742/Default.aspx

Thanks, Al
eo_support
Posted: Friday, January 4, 2008 9:20:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We were able to reproduce and fix the problem with the sampe app you provided. Please check your private message for download location of the new build that contains the fix.

Thanks
sunsethill
Posted: Friday, January 4, 2008 9:40:05 AM
Rank: Member
Groups: Member

Joined: 10/15/2007
Posts: 8
Thanks for your prompt attention to this issue. I'll download the new build and test this afternoon.

I'm very impressed with your customer service. Thanks again !


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.