<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReferenceUpdate.aspx.cs" Inherits="ReferenceUpdate" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p >
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource1" Height="50px" Width="125px"
CellPadding="4" ForeColor="#333333" GridLines="None" DefaultMode="Edit"
OnItemUpdated="ReferenceView_ItemUpdate"
OnItemCommand="ReferenceView_ItemCommand">
<FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
<CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
<RowStyle BackColor="#E3EAEB" />
<FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="url" HeaderText="url" SortExpression="url" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
SortExpression="CategoryID" />
<asp:BoundField DataField="ReferenceID" HeaderText="ReferenceID"
SortExpression="ReferenceID" />
<asp:CommandField ShowEditButton="True" />
</Fields>
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#7C6F57" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>
</p>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:H:\DOTNET\APP_DATA\LIBRARY.MDFConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:H:\DOTNET\APP_DATA\LIBRARY.MDFConnectionString1.ProviderName %>"
SelectCommand="SELECT [url], [Title], [CategoryID], [ReferenceID] FROM [References] WHERE [ReferenceID] = @ReferenceID"
UpdateCommand="UPDATE [References] SET [url] = @url, [Title] = @Title, [CategoryID] = @CategoryID">
<SelectParameters>
<asp:QueryStringParameter Name="ReferenceID"
QueryStringField="ReferenceID" Type="Char" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
Do more with
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:H:\DOTNET\APP_DATA\LIBRARY.MDFConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:H:\DOTNET\APP_DATA\LIBRARY.MDFConnectionString1.ProviderName %>"
SelectCommand="SELECT [url], [Title], [CategoryID], [ReferenceID] FROM [References] WHERE [ReferenceID] = @ReferenceID"
UpdateCommand="UPDATE [References] SET [url] = @url, [Title] = @Title, [CategoryID] = @CategoryID WHERE [ReferenceID] = @ReferenceID">
<SelectParameters>
<asp:QueryStringParameter Name="ReferenceID"
QueryStringField="ReferenceID" Type="Char" />
</SelectParameters>
<UpdateParameters>
<asp:QueryStringParameter Name="ReferenceID"
QueryStringField="ReferenceID" Type="Char" />
</UpdateParameters>
</asp:SqlDataSource>
Premium Content
You need an Expert Office subscription to comment.Start Free Trial