Hi,
I have a grid inside a CallbackPanel control with a column with DateTime date type. But, when the CallbackPanel is trigger, no value is passed to the server side in the column.
To demonstrate the problem, I am posting the code below:
Quote:<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Jquery._Default" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>GridColumn Date Type Test</title>
<script language="javascript">
function OpenDialog()
{
eo_GetObject('dlgTest').show(true);
return false;
}
function add_month(d, m){
var date = new Date(d);
//detalhe ele retorna 0 para janeiro e 11 para dezembro
var month = date.getMonth();
//crio uma nova váriavel com a nova data, Date(ano, mes(soma da variavel enviada para o metodo + o mes atual, dia que eu coloquei padrão para 1
var n_date = new Date(date.getFullYear(), eval(m+month), 1);
return n_date;
}
var basnr = 1230;
var basdt = new Date();
var basdtend = add_month(basdtini, 10);
function CreateRow()
{
var grid = eo_GetObject("grdData");
var item = grid.addItem();
var inx = item.getIndex();
var cell = item.getCell(0);
cell.setValue(0);
cell = item.getCell(1);
var cpynr = basnr + (inx * 2);
cell.setValue(cpynr.toString());
cell = item.getCell(2);
cell.setValue("Company " + cpynr.toString());
cell = item.getCell(3);
var dtini = add_month(basdt, (inx * 3) + 1);
cell.setValue(dtini);
cell = item.getCell(4);
var dtend = add_month(dtini, (inx * 2) + 10);
cell.setValue(dtend);
cell = item.getCell(5);
var qtd = (inx + 1).toString() + ",000";
cell.setValue(qtd);
return false;
}
function CallBack()
{
eo_Callback('cbpGrid', 'UPDATE');
return false;
}
</script>
</head>
<body bottommargin="20" leftmargin="20" rightmargin="20" topmargin="20">
<form id="form1" runat="server">
<div style="font-weight: bold; font-size: 16pt; font-family: Verdana">
GridColumn Date Type Test<br />
<br />
<asp:Button ID="cmdGridCharge" runat="server" Font-Bold="True" OnClientClick="return CreateRow();"
Text="Create Row" Font-Names="Verdana" Font-Size="10pt" />
<asp:Button ID="cmdCallBack" runat="server" Font-Bold="True" OnClientClick="return CallBack();"
Text="CallBack" Font-Names="Verdana" Font-Size="10pt" /><br />
<br />
<eo:CallbackPanel ID="cbpGrid" runat="server" Height="150px" Width="100%">
<eo:Grid ID="grdData" runat="server" BorderWidth="2px" ClientSideOnItemSelected="OnItemSelected"
ColumnHeaderAscImage="00050303" ColumnHeaderDescImage="00050304" ColumnHeaderDividerImage="00050402"
ColumnHeaderHeight="35" FixedColumnCount="1" Font-Bold="False" Font-Italic="False"
Font-Names="Verdana" Font-Overline="False" Font-Size="7.5pt" Font-Strikeout="False"
Font-Underline="False" GridLineColor="199, 209, 223" GridLines="Both" Width="488px" Height="150px" BorderColor="#003399" BorderStyle="Solid">
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="COLOR: #003399; BACKGROUND-COLOR: white" />
<ItemHoverStyle CssText="BACKGROUND-REPEAT: repeat-x; COLOR: #003399; BACKGROUND-COLOR: #f5f5ff" />
<SelectedStyle CssText="background-color:#cee7fe;background-repeat:repeat-x;color:#003399;" />
<CellStyle CssText="color:firebrick;font-family:Verdana;padding-left:8px;padding-top:1px;white-space:wrap;" />
</eo:GridItemStyleSet>
</ItemStyles>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
</eo:TextBoxColumn>
<eo:DateTimeColumn>
<DatePicker ControlSkinID="None" DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter"
DisabledDates="" OtherMonthDayVisible="True" SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon">
<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" />
<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" />
<PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<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" />
</DatePicker>
</eo:DateTimeColumn>
<eo:MaskedEditColumn>
<MaskedEdit ControlSkinID="None" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
</MaskedEdit>
</eo:MaskedEditColumn>
</ColumnTemplates>
<Columns>
<eo:StaticColumn DataField="STATUS" DataType="Integer" HeaderText="STATUS" Name="STATUS"
Visible="False" Width="1">
</eo:StaticColumn>
<eo:StaticColumn DataField="DCCM_CD_PARTNER_SAP" DataType="String" HeaderText="Partner #"
Name="DCCM_CD_PARTNER_SAP" Width="65">
<CellStyle CssText="VERTICAL-ALIGN: top; TEXT-ALIGN: left" />
</eo:StaticColumn>
<eo:StaticColumn DataField="DCCM_NM_PARTNER_SAP" DataType="String" HeaderText="Partner Name"
Name="DCCM_NM_PARTNER_SAP" Width="160">
<CellStyle CssText="VERTICAL-ALIGN: top; TEXT-ALIGN: left" />
</eo:StaticColumn>
<eo:StaticColumn DataField="DCCM_DT_INITIAL" DataFormat="{0:MM/dd/yyyy}" DataType="DateTime"
HeaderText="Initial Date" Name="DCCM_DT_INITIAL" Width="70">
<CellStyle CssText="VERTICAL-ALIGN: top; TEXT-ALIGN: center" />
</eo:StaticColumn>
<eo:StaticColumn DataField="DCCM_DT_FINAL" DataFormat="{0:MM/dd/yyyy}" DataType="DateTime"
HeaderText="End Date" Name="DCCM_DT_FINAL" Width="70">
<CellStyle CssText="VERTICAL-ALIGN: top; TEXT-ALIGN: center" />
</eo:StaticColumn>
<eo:StaticColumn DataField="DCCM_QT_MATERIAL_LICENSE" DataType="String" HeaderText="Quantity"
Name="DCCM_QT_MATERIAL_LICENSE">
<CellStyle CssText="TEXT-ALIGN: right" />
</eo:StaticColumn>
</Columns>
<ColumnHeaderStyle CssText="background-color:steelblue;color:white;font-family:Verdana;font-size:7pt;font-weight:bold;padding-left:4px;padding-top:2px;vertical-align:middle;" />
<ColumnHeaderTextStyle CssText="background-color:steelblue;" />
</eo:Grid>
<br />
<div id="divGrid" runat="server" style="font-size: 8pt; width: 100%; color: #003399; font-family: Verdana; height: 150px">
</div>
</eo:CallbackPanel>
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>
Quote:Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub cbpGrid_Execute(ByVal sender As System.Object, ByVal e As EO.Web.CallbackEventArgs) Handles cbpGrid.Execute
Dim GridRow As EO.Web.GridItem, Ctr As Integer
Me.divGrid.InnerHtml = ""
For Ctr = 0 To grdData.Items.Count - 1
GridRow = grdData.Items(Ctr)
Me.divGrid.InnerHtml &= "Row: " & Ctr.ToString & " => " & _
"Partner # (" & IIf(GridRow.Cells("DCCM_CD_PARTNER_SAP").Value <> Nothing, GridRow.Cells("DCCM_CD_PARTNER_SAP").Value, "NOTHING") & ")" & _
"; Partner Name (" & IIf(GridRow.Cells("DCCM_NM_PARTNER_SAP").Value <> Nothing, GridRow.Cells("DCCM_NM_PARTNER_SAP").Value, "NOTHING") & ")" & _
"; Initial Date (" & IIf(GridRow.Cells("DCCM_DT_INITIAL").Value <> Nothing, GridRow.Cells("DCCM_DT_INITIAL").Value, "NOTHING") & ")" & _
"; End Date (" & IIf(GridRow.Cells("DCCM_DT_FINAL").Value <> Nothing, GridRow.Cells("DCCM_DT_FINAL").Value, "NOTHING") & ")" & _
"; Quantity (" & IIf(GridRow.Cells("DCCM_QT_MATERIAL_LICENSE").Value <> Nothing, GridRow.Cells("DCCM_QT_MATERIAL_LICENSE").Value, "NOTHING") & ")</br>"
Next
End Sub
End Class
Press "Create Row" buttom to insert a new row in grid. The columns "Initial Date" and "End Date" are filled with dates, as below in the outline in red:
But, when the "Callback" button is pressed, the values are not passed to the server side (underlined in red) and disappear on the client side (outline in red), as below>
I use Visual Studio 2005 and 16.1.17.0 version of EO. How can I fix this problem?
Regards,
Marcelo Camarate