J
jagbal
Hi,
I am using a Datagrid for displaying records from the SQL Server
database.
I am having the foll. code in the .aspx page
------------------------------------------------------------------------------------
<asp:TemplateColumn SortExpression="AMOUNT"
HeaderText="Amount">
<ItemStyle HorizontalAlign="Right"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:Label id=lblAmount Text='<%# String.Format("{0:N}",
Convert.ToInt32(Container.DataItem("Amount"))) %>'
Runat="server">
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtAmount" Runat="server">
<%# Container.DataItem("Amount") %>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
------------------------------------------------------------------------------------
I am trying to display the "Amount" in formatted way and i am able to
do it.
When i am trying to edit the record in the datagrid by clicking the
edit link, it is giving me the foll. error
Server Error in '/ConsHistory' Application.
--------------------------------------------------------------------------------
'TextBox' cannot have children of type 'DataBoundLiteralControl'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 'TextBox' cannot have
children of type 'DataBoundLiteralControl'.
Source Error:
Line 160: </ItemTemplate>
Line 161: <EditItemTemplate>
Line 162: <asp:TextBox id="txtAmount" Runat="server">
Line 163: <%# Container.DataItem("Amount") %>
Line 164: </asp:TextBox>
-----------------------------------------------------------------------
I need some one to help me in editing the record in the formatted
way.
Thanks in advance
Regards,
Bala
I am using a Datagrid for displaying records from the SQL Server
database.
I am having the foll. code in the .aspx page
------------------------------------------------------------------------------------
<asp:TemplateColumn SortExpression="AMOUNT"
HeaderText="Amount">
<ItemStyle HorizontalAlign="Right"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:Label id=lblAmount Text='<%# String.Format("{0:N}",
Convert.ToInt32(Container.DataItem("Amount"))) %>'
Runat="server">
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtAmount" Runat="server">
<%# Container.DataItem("Amount") %>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
------------------------------------------------------------------------------------
I am trying to display the "Amount" in formatted way and i am able to
do it.
When i am trying to edit the record in the datagrid by clicking the
edit link, it is giving me the foll. error
Server Error in '/ConsHistory' Application.
--------------------------------------------------------------------------------
'TextBox' cannot have children of type 'DataBoundLiteralControl'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 'TextBox' cannot have
children of type 'DataBoundLiteralControl'.
Source Error:
Line 160: </ItemTemplate>
Line 161: <EditItemTemplate>
Line 162: <asp:TextBox id="txtAmount" Runat="server">
Line 163: <%# Container.DataItem("Amount") %>
Line 164: </asp:TextBox>
-----------------------------------------------------------------------
I need some one to help me in editing the record in the formatted
way.
Thanks in advance
Regards,
Bala