Et par spørgsmål til detailsview ?
Hejsa,Jeg har lavet et detailsview med en række label's og textbox'es og en enkelt button. Det jeg lige skal vide lidt om er hvordan jeg trækker data fra diverse textbox'es når jeg klikker på min button ?
Mit detailsview ser således ud i html :
<asp:DetailsView ID="EditView"
AutoGenerateRows="False"
BorderStyle="None"
BorderWidth="0px"
cellpadding="2"
Width="100%"
runat="server">
<Fields>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<HeaderTemplate>
<asp:Label ID="LabelRoleName"
runat="server"
EnableViewState="False"
Text="<%$ Resources:Roles, LabelRoleName %>">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemTemplate>
<asp:TextBox ID="txt_RoleName"
Text='<%# Bind("RoleName") %>'
runat="server"
EnableViewState="False"
CssClass="formfields">
</asp:TextBox>
<asp:RequiredFieldValidator ID="ValidRoleName" runat="server" ControlToValidate="txt_RoleName"
ErrorMessage="<%$ Resources:Roles, ErrorRolenameValid %>" ForeColor="#C80000">*</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<HeaderTemplate>
<asp:Label ID="LabelRoleDescription"
runat="server"
Text="<%$ Resources:Roles, LabelRoleDescription %>">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemTemplate>
<asp:TextBox ID="txt_RoleDescription"
runat="server"
CssClass="formfields"
Height="75px"
MaxLength="500"
TextMode="MultiLine"
Width="250px"
EnableViewState="False"
Text='<%# Bind("Description") %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" />
<HeaderTemplate>
<asp:Label ID="LabelAddedOn"
Text='<%$ Resources:Default, LabelAddedOn %>'
runat="server">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="LabelAddDate" Text='<%# Bind("AddDate") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" />
<HeaderTemplate>
<asp:Label ID="LabelAddedBy"
Text='<%$ Resources:Default, LabelAddedBy %>'
runat="server">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="LabelAddBy" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" />
<HeaderTemplate>
<asp:Label ID="LabelEditedOn"
Text='<%$ Resources:Default, LabelEditedOn %>'
runat="server">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="LabelEditDate" Text='<%# Bind("EditDate") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle HorizontalAlign="Left" />
<HeaderTemplate>
<asp:Label ID="LabelEditedBy"
Text='<%$ Resources:Default, LabelEditedBy %>'
runat="server">
</asp:Label>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Label ID="LabelEditBy" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle HorizontalAlign="Left" />
<ItemTemplate>
<asp:Button ID="ButtonEditRole"
CssClass="formbuttons"
Text="<%$ Resources:Roles, ButtonRoleEdit %>"
runat="server">
</asp:Button>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>