
<asp:DetailsView ID="DetailsView1" AutoGenerateRows="false"
datakeynames="AccountCode" DataSourceID="MyDataSource"
AutoGenerateInsertButton="true" AutoGenerateEditButton="true"
AllowPaging="true" runat="server" >
<Fields>
<asp:boundfield datafield="AccountCode" headertext="Code of Account"/>
<asp:boundfield datafield="AccountName" headertext="Name of Account"/>
<asp:boundfield datafield="AccountDescription" headertext="Description"/>
<asp:TemplateField HeaderText="Parent Group">
<ItemTemplate>
<%#Eval("GroupName")%>
</ItemTemplate>
<InsertItemTemplate>
<asp:DropDownList id="GroupList" datasourceid="GroupSqlDataSource"
datatextfield="GroupName" DataValueField="GroupCode"
SelectedValue='<%# Bind("AccountPGroup") %>' runat="server"/>
</InsertItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="GroupList" datasourceid="GroupSqlDataSource"
datatextfield="GroupName" DataValueField="GroupCode"
SelectedValue='<%# Bind("AccountPGroup") %>' runat="server"/>
</EditItemTemplate>
</asp:TemplateField>
<asp:boundfield datafield="AccountAddress1" headertext="First Address"/>
<asp:boundfield datafield="AccountAddress2" headertext="Second Address"/>
<asp:boundfield datafield="AccountPhone" headertext="Phone of Account"/>
<asp:boundfield datafield="AccountCity" headertext="City of Account"/>
<asp:boundfield datafield="AccountOpamt" headertext="Opening balance" />
<asp:boundfield datafield="AccountClamt" headertext="Closing balance"/>
<asp:boundfield datafield="AccountCat" headertext="Category of account"/>
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="MyDataSource" ConnectionString="<%$Connectionstrings:ERPConnectionString%>"
SelectCommand="SELECT AccountsTable.AccountCode,AccountsTable.AccountName,
AccountsTable.AccountDescription,GroupTable.GroupName,
AccountsTable.AccountPgroup,AccountsTable.AccountAddress1,AccountsTable.AccountAddress2,
AccountsTable.AccountPhone,AccountsTable.AccountCity,
AccountsTable.AccountOpamt,AccountsTable.AccountClamt,
AccountsTable.AccountCat FROM AccountsTable,GroupTable
WHERE AccountsTable.AccountPgroup=GroupTable.GroupCode"
UpdateCommand="Update AccountsTable SET AccountName=@AccountName,AccountDescription
=@AccountDescription,AccountAddress1=
@AccountAddress1,AccountAddress2=@AccountAddress2,AccountPhone=@AccountPhone,
AccountCity=@AccountCity,AccountOpamt=@AccountOpamt, AccountClamt=@AccountClamt,
AccountCat=@AccountCat,AccountPGroup=@AccountPgroup Where AccountCode=@AccountCode"
Insertcommand="Insert AccountsTable (AccountCode, AccountName, AccountDescription,
AccountPgroup,AccountAddress1,AccountAddress2,
AccountPhone,AccountCity,AccountOpamt, AccountClamt, AccountCat)
values(@AccountCode,@AccountName,@AccountDescription,@AccountPgroup,
@AccountAddress1,@AccountAddress2,@AccountPhone,@AccountCity,
@AccountOpamt,@AccountClamt,@AccountCat)" runat="server"/>
<asp:SqlDataSource ID="GroupSqlDataSource" ConnectionString="<%$Connectionstrings:ERPConnectionString%>"
SelectCommand="SELECT GroupCode,GroupName FROM GroupTable" runat="server"/>
Copyright © 2012 - All Rights Reserved - VKInfotek.com