Jul 15, 2013, 9:55 AM
[CLOSED] asp:datalist inside ext window item.count always zero
Hi,
I have asp:datalist inside a ext:window, i am binding the asp:datalist on click of button and showing the window at the same time which works fine.
But on click of another button which is in the window i count the items in datalist "Datalist.items.count" which is always Zero, however datalist is visible on the screen with data.
Please help in this , Below is my code
.Aspx
__________________________________________________ _________________________________________________
Binding DataList
__________________________________________________ __________________________________________________ ________
btnSaveCTC_DirectClick event where i count the items
__________________________________________________ __________________________________________________ ___________
I have asp:datalist inside a ext:window, i am binding the asp:datalist on click of button and showing the window at the same time which works fine.
But on click of another button which is in the window i count the items in datalist "Datalist.items.count" which is always Zero, however datalist is visible on the screen with data.
Please help in this , Below is my code
.Aspx
__________________________________________________ _________________________________________________
<ext:Window ID="winGetSplit" runat="server" Modal="true" Hidden="true" EnableViewState="true" Padding="5"
Title="split Process" Height="250" Width="450">
<Items>
<ext:TextField ID="tfCurrentCTC" runat="server" FieldLabel="Current CTC" Width="300"
Padding="5" ReadOnly="true">
</ext:TextField>
<ext:ComboBox ID="cbPayrollPolicy" runat="server" FieldLabel="Payroll Policy" Padding="5"
Width="300">
<Store>
<ext:Store ID="strPayrollPolicy" runat="server">
<Model>
<ext:Model ID="mdPayrollPolicy" runat="server">
<Fields>
<ext:ModelField Name="pk_CatalogMaster">
</ext:ModelField>
<ext:ModelField Name="catlShortDesc">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
<ext:DateField ID="dfCompDate" runat="server" FieldLabel="Effective Date" Padding="5"></ext:DateField>
</Items>
<Content>
<table>
<tr>
<td>
<asp:DataList ID="dlSpitCTC" runat="server" EnableViewState="true">
<ItemTemplate>
<table>
<tr>
<td style="display: none">
</td>
<td style="padding: 3px">
<asp:Label ID="lblElementName" Visible="true" runat="server" Text='<%# Eval("Component code") %>'
Width="100px"></asp:Label>
</td>
<td style="padding: 3px">
<asp:TextBox ID="txtCompElement" runat="server" Text='<%# Eval("Amount") %>'></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
</Content>
<Buttons>
<ext:Button ID="btnSaveCTC" runat="server" Text="Save" Icon="Disk" OnDirectClick="btnSaveCTC_DirectClick">
</ext:Button>
<ext:Button ID="Button12" runat="server" Text="Cancel" Icon="Cancel">
</ext:Button>
</Buttons>
</ext:Window>
Binding DataList
__________________________________________________ __________________________________________________ ________
private void Split()
{
DataSet dssplit = fn.SplitCTC("576", tfCurrentCTC.Text);/// Function to bind data, you can use yours
if (X.IsAjaxRequest)
{
dlSpitCTC.DataSource = dssplit;
dlSpitCTC.DataBind();
dlSpitCTC.Update();
cbPayrollPolicy.Render();
winGetSplit.Render();
winGetSplit.Show();
}
}
btnSaveCTC_DirectClick event where i count the items
__________________________________________________ __________________________________________________ ___________
try
{
for (int i = 0; i < dlSpitCTC.Items.Count; i++)
{
////Some Code
}
}
catch (Exception ex)
{
X.Msg.Alert("Status", ex.Message, new JFunction { Fn = "" }).Show();
}
Last edited by Daniil; Jul 23, 2013 at 12:54 PM.
Reason: [CLOSED]