Nov 11, 2008, 7:19 AM
Formlayout,Textfield in asp.net FormView problem
oops!! I tried many time to figure out from where to add new post and finally I found it, seems it was hidden until you reply to a post or simply I was idiot enough to miss the "Add new topic" button. Anyway i finally make it. So here problems I face:
- TextField controls within an asp.net FormView control didn't show values they being bound to. They always been empty, but will accept new values and forward them to data source.
- The second is when try yo include a Panel/FieldSet/FormLayout within the asp.net FormView differnet templates -insert item template/updateItemTempalte/ItemTemplate-, the page will throw a Compilation Error exception stating that the control is already decleared before. It seems to be a namingContainer problem.
- Control's within formLayout will not be reconized fo 2 way binding, so when try to insert or update the datasource control will through an exctiption "LinqDataSource 'LinqDataSource1' has no values to insert. Check that the 'values' dictionary contains values."
- when I add buttons in a panel buttons and give invoke their defined commands
here a code snippte for what I am trying to do:
<asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="EN"
DataSourceID="LinqDataSource1">
<EditItemTemplate>
<ext:Panel ID="Panel2" runat="server" Height="300" Title="Title">
<Content>
<ext:FormLayout ID="FormLayout1" runat="server">
<ext:Anchor>
<ext:Label ID="ENLabel1" runat="server" Text='<%# Eval("EN") %>' />
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="ARTextBox" runat="server" Text='<%# Bind("AR") %>' />
</ext:Anchor>
</ext:FormLayout>
</Content>
</ext:Panel>
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update" />
&nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
<ext:Panel ID="Panel1" runat="server" Height="300" Title="Title">
<Content>
<ext:FormLayout ID="FormLayout2" runat="server">
<ext:Anchor>
<ext:TextField ID="ENTextBox" runat="server" Text='<%# Bind("EN") %>' />
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="ARTextBox" runat="server" Text='<%# Bind("AR") %>' />
</ext:Anchor>
</ext:FormLayout>
</Content>
<Buttons>
<ext:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</ext:Button>
<ext:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</ext:Button>
</Buttons>
</ext:Panel>
</InsertItemTemplate>
<ItemTemplate>
EN:
<ext:Label ID="ENLabel" runat="server" Text='<%# Eval("EN") %>' />
<br />
AR:
<ext:Label ID="ARLabel" runat="server" Text='<%# Bind("AR") %>' />
<br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit" />
&nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
Text="Delete" />
&nbsp;
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="New" />
</ItemTemplate>
<EmptyDataTemplate>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="New" />
</EmptyDataTemplate>
</asp:FormView>
I don't know what I suppose to do... so any help will apprcieated.