FormViewPageEventHandler デリゲート
アセンブリ: System.Web (system.web.dll 内)

/** @delegate */ public delegate void FormViewPageEventHandler ( Object sender, FormViewPageEventArgs e )

FormView コントロールは、コントロール内のページャ ボタン (CommandName プロパティが "Page" に設定されたボタン) がクリックされたときに、FormView コントロールでページング操作を処理する前に PageIndexChanging イベントを発生させます。これにより、このイベントが発生するたびにカスタム ルーチン (ページング操作のキャンセルなど) を実行するイベント処理メソッドを提供できます。
![]() |
---|
FormViewPageEventHandler デリゲートを作成する場合は、イベントを処理するメソッドを識別してください。イベントをイベント ハンドラに関連付けるには、デリゲートのインスタンスをイベントに追加します。デリゲートを削除しない限り、そのイベントが発生すると常にイベント ハンドラが呼び出されます。イベント ハンドラ デリゲートの詳細については、「イベントとデリゲート」を参照してください。

FormViewPageEventHandler デリゲートを、プログラムによって FormView コントロールの PageIndexChanging イベントに追加する方法を次の例に示します。
<%@ Page language="VB" %> <%@ import namespace="System.Data"%> <script runat="server"> ' To dynamically create a template for a FormView control, ' you must create a custom template class to represent ' the template. This template class represents the item ' template for a FormView control. Private NotInheritable Class EmployeeItemTemplate Implements ITemplate ' When implementing the ITemplate interface, you must ' implement the InstantiateIn method. The FormView ' control calls this method to create the template's ' content. Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn ' Create the child controls contained in the template. ' For this example, the item template displays the ' FirstName and LastName fields from the data source. ' To support data binding, create event handlers ' for the DataBinding event of each child control. ' The event handlers must bind the appropriate value ' to each control. Dim firstNameLabel As New Label() firstNameLabel.ID = "FirstNameLabel" AddHandler firstNameLabel.DataBinding, AddressOf FirstNameLabel_DataBinding Dim nameLineBreak As New LiteralControl("<br/>") Dim buttonLineBreak As New LiteralControl("<br/>") Dim lastNameLabel As New Label() lastNameLabel.ID = "LastNameLabel" AddHandler lastNameLabel.DataBinding, AddressOf LastNameLabel_DataBinding Dim editButton As New Button() editButton.ID = "EditButton" editButton.CommandName = "Edit" editButton.Text = "Edit" ' Add the controls to the Controls collection of the ' container control. container.Controls.Add(firstNameLabel) container.Controls.Add(nameLineBreak) container.Controls.Add(lastNameLabel) container.Controls.Add(buttonLineBreak) container.Controls.Add(editButton) End Sub ' This event handler binds the value of the FirstName field ' to the FirstNameLabel Label control displayed in the template. Private Sub FirstNameLabel_DataBinding(ByVal sender As Object, ByVal e As EventArgs) ' Use the sender parameter to retrieve the Label control ' being bound to data. Dim firstNameLabelControl As Label = CType(sender, Label) ' Retrieve the value to bind to the Label control. First, ' use the NamingContainer property to retrieve the parent ' control of the Label control. In this example, the parent ' control is the FormView control. Dim formViewContainer As FormView = CType(firstNameLabelControl.NamingContainer, FormView) ' Get the data item bound to the FormView control. Dim rowView As DataRowView = CType(formViewContainer.DataItem, DataRowView) ' Use the data item to retrieve the value of the FirstName field. ' Set the Text property of the Label control to this value. firstNameLabelControl.Text = rowView("FirstName").ToString() End Sub ' This event handler binds the value of the LastName field ' to the LastNameLabel Label control displayed in the template. Private Sub LastNameLabel_DataBinding(ByVal sender As Object, ByVal e As EventArgs) ' Use the sender parameter to retrieve the Label control ' being bound to data. Dim lastNameLabelControl As Label = CType(sender, Label) ' Retrieve the value to bind to the Label control. First, ' use the NamingContainer property to retrieve the parent ' control of the Label control. In this example, the parent ' control is the FormView control. Dim formViewContainer As FormView = CType(lastNameLabelControl.NamingContainer, FormView) ' Get the data item bound to the FormView control. Dim rowView As DataRowView = CType(formViewContainer.DataItem, DataRowView) ' Use the data item to retrieve the value of the LastName field. ' Set the Text property of the Label control to this value. lastNameLabelControl.Text = rowView("LastName").ToString() End Sub End Class ' This template class represents the edit item ' template for a FormView control. Private NotInheritable Class EmployeeEditItemTemplate Implements ITemplate Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn ' Create the child controls contained in the template. ' The edit item template should contain the input ' controls for the user to edit a record. Dim firstNameTextBox As New TextBox() firstNameTextBox.ID = "FirstNameTextBox" Dim nameLineBreak As New LiteralControl("<br/>") Dim buttonLineBreak As New LiteralControl("<br/>") Dim lastNameTextBox As New TextBox() lastNameTextBox.ID = "LastNameTextBox" Dim updateButton As New Button() updateButton.ID = "UpdateButton" updateButton.CommandName = "Update" updateButton.Text = "Update" Dim cancelButton As New Button() cancelButton.ID = "CancelButton" cancelButton.CommandName = "Cancel" cancelButton.Text = "Cancel" ' Add the controls to the Controls collection of the ' container control. container.Controls.Add(firstNameTextBox) container.Controls.Add(nameLineBreak) container.Controls.Add(lastNameTextBox) container.Controls.Add(buttonLineBreak) container.Controls.Add(updateButton) container.Controls.Add(cancelButton) End Sub End Class Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Create a new FormView object. Dim employeesFormView As New FormView() ' Set the FormView object's properties. employeesFormView.ID = "EmployeesFormView" employeesFormView.DataSourceID = "EmployeeSource" employeesFormView.AllowPaging = True employeesFormView.HeaderText = "Employee Name" Dim keyArray() As String = {"EmployeeID"} employeesFormView.DataKeyNames = keyArray ' Programmatically register the event handlers for ' the FormView control. AddHandler employeesFormView.PageIndexChanging, AddressOf EmployeeFormView_PageIndexChanging AddHandler employeesFormView.ModeChanged, AddressOf EmployeeFormView_ModeChanged AddHandler employeesFormView.ItemUpdating, AddressOf EmployeeFormView_ItemUpdating ' Create the dynamic templates using the custom template classes. employeesFormView.ItemTemplate = New EmployeeItemTemplate() employeesFormView.EditItemTemplate = New EmployeeEditItemTemplate() ' Add the FormView object to the Controls collection ' of the PlaceHolder control. FormViewPlaceHolder.Controls.Add(employeesFormView) End Sub Sub EmployeeFormView_ItemUpdating(ByVal sender As Object, ByVal e As FormViewUpdateEventArgs) ' Because the FormView control is dynamically generated, ' the NewValues collection must be programmatically populated ' with the values for the record to update. ' Use the sender argument to retrieve the FormView ' control that raised the event. Dim employeeFormView As FormView = CType(sender, FormView) ' Retrieve the data row from the FormView control. Dim row As FormViewRow = employeeFormView.Row ' Retrieve the TextBox controls that contain the updated values ' entered by the user. Dim firstNameTextBox As TextBox = CType(row.FindControl("FirstNameTextBox"), TextBox) Dim lastNameTextBox As TextBox = CType(row.FindControl("LastNameTextBox"), TextBox) If firstNameTextBox IsNot Nothing And lastNameTextBox IsNot Nothing Then ' Add the new values to the NewValues collections. e.NewValues.Add("FirstName", firstNameTextBox.Text) e.NewValues.Add("LastName", lastNameTextBox.Text) End If End Sub Sub EmployeeFormView_PageIndexChanging(ByVal sender As Object, ByVal e As FormViewPageEventArgs) ' Use the sender argument to retrieve the FormView ' control that raised the event. Dim employeeFormView As FormView = CType(sender, FormView) ' Cancel the paging operation if the FormView control ' is in edit mode. If employeeFormView.CurrentMode = FormViewMode.Edit Then e.Cancel = True ' Display an error message. Dim newPage As Integer = e.NewPageIndex + 1 MessageLabel.Text = "Please update the current record before moving to page " & _ newPage.ToString() & "." End If End Sub Sub EmployeeFormView_ModeChanged(ByVal sender As Object, ByVal e As EventArgs) ' Clear the message label. MessageLabel.Text = "" End Sub </script> <html> <body> <form runat="server"> <h3>FormView Example</h3> <!-- Use a PlaceHolder control as the container for the --> <!-- dynamically generated FormView control. --> <asp:placeholder id="FormViewPlaceHolder" runat="server"/> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName Where [EmployeeID]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <%@ import namespace="System.Data"%> <script runat="server"> // To dynamically create a template for a FormView control, // you must create a custom template class to represent // the template. This template class represents the item // template for a FormView control. private sealed class EmployeeItemTemplate : ITemplate { // When implementing the ITemplate interface, you must // implement the InstantiateIn method. The FormView // control calls this method to create the template's // content. void ITemplate.InstantiateIn(Control container) { // Create the child controls contained in the template. // For this example, the item template displays the // FirstName and LastName fields from the data source. // To support data binding, create event handlers // for the DataBinding event of each child control. // The event handlers must bind the appropriate value // to each control. Label firstNameLabel = new Label(); firstNameLabel.ID = "FirstNameLabel"; firstNameLabel.DataBinding += new EventHandler(FirstNameLabel_DataBinding); LiteralControl nameLineBreak = new LiteralControl("<br/>"); LiteralControl buttonLineBreak = new LiteralControl("<br/>"); Label lastNameLabel = new Label(); lastNameLabel.ID = "LastNameLabel"; lastNameLabel.DataBinding += new EventHandler(LastNameLabel_DataBinding); Button editButton = new Button(); editButton.ID = "EditButton"; editButton.CommandName = "Edit"; editButton.Text = "Edit"; // Add the controls to the Controls collection of the // container control. container.Controls.Add(firstNameLabel); container.Controls.Add(nameLineBreak); container.Controls.Add(lastNameLabel); container.Controls.Add(buttonLineBreak); container.Controls.Add(editButton); } // This event handler binds the value of the FirstName field // to the FirstNameLabel Label control displayed in the template. private void FirstNameLabel_DataBinding(Object sender, EventArgs e) { // Use the sender parameter to retrieve the Label control // being bound to data. Label firstNameLabelControl = (Label)sender; // Retrieve the value to bind to the Label control. First, // use the NamingContainer property to retrieve the parent // control of the Label control. In this example, the parent // control is the FormView control. FormView formViewContainer = (FormView)firstNameLabelControl.NamingContainer; // Get the data item bound to the FormView control. DataRowView rowView = (DataRowView)formViewContainer.DataItem; // Use the data item to retrieve the value of the FirstName field. // Set the Text property of the Label control to this value. firstNameLabelControl.Text = rowView["FirstName"].ToString(); } // This event handler binds the value of the LastName field. // to the LastNameLabel Label control displayed in the template. private void LastNameLabel_DataBinding(Object sender, EventArgs e) { // Use the sender parameter to retrieve the Label control // being bound to data. Label lastNameLabelControl = (Label)sender; // Retrieve the value to bind to the Label control. First, // use the NamingContainer property to retrieve the parent // control of the Label control. In this example, the parent // control is the FormView control. FormView formViewContainer = (FormView)lastNameLabelControl.NamingContainer; // Get the data item bound to the FormView control. DataRowView rowView = (DataRowView)formViewContainer.DataItem; // Use the data item to retrieve the value of the LastName field. // Set the Text property of the Label control to this value. lastNameLabelControl.Text = rowView["LastName"].ToString(); } } // This template class represents the edit item // template for a FormView control. private sealed class EmployeeEditItemTemplate : ITemplate { void ITemplate.InstantiateIn(Control container) { // Create the child controls contained in the template. // The edit item template should contain the input // controls for the user to edit a record. TextBox firstNameTextBox = new TextBox(); firstNameTextBox.ID = "FirstNameTextBox"; LiteralControl nameLineBreak = new LiteralControl("<br/>"); LiteralControl buttonLineBreak = new LiteralControl("<br/>"); TextBox lastNameTextBox = new TextBox(); lastNameTextBox.ID = "LastNameTextBox"; Button updateButton = new Button(); updateButton.ID = "UpdateButton"; updateButton.CommandName = "Update"; updateButton.Text = "Update"; Button cancelButton = new Button(); cancelButton.ID = "CancelButton"; cancelButton.CommandName = "Cancel"; cancelButton.Text = "Cancel"; // Add the controls to the Controls collection of the // container control. container.Controls.Add(firstNameTextBox); container.Controls.Add(nameLineBreak); container.Controls.Add(lastNameTextBox); container.Controls.Add(buttonLineBreak); container.Controls.Add(updateButton); container.Controls.Add(cancelButton); } } void Page_Load(Object sender, EventArgs e) { // Create a new FormView object. FormView employeesFormView = new FormView(); // Set the FormView object's properties. employeesFormView.ID = "EmployeesFormView"; employeesFormView.DataSourceID = "EmployeeSource"; employeesFormView.AllowPaging = true; employeesFormView.HeaderText = "Employee Name"; employeesFormView.DataKeyNames = new String[1] { "EmployeeID" }; // Programmatically register the event handlers for // the FormView control. employeesFormView.PageIndexChanging += new FormViewPageEventHandler(EmployeeFormView_PageIndexChanging); employeesFormView.ModeChanged += new EventHandler(EmployeeFormView_ModeChanged); employeesFormView.ItemUpdating += new FormViewUpdateEventHandler(EmployeeFormView_ItemUpdating); // Create the dynamic templates using the custom template classes. employeesFormView.ItemTemplate = new EmployeeItemTemplate(); employeesFormView.EditItemTemplate = new EmployeeEditItemTemplate(); // Add the FormView object to the Controls collection // of the PlaceHolder control. FormViewPlaceHolder.Controls.Add(employeesFormView); } void EmployeeFormView_ItemUpdating(Object sender, FormViewUpdateEventArgs e) { // Because the FormView control is dynamically generated, // the NewValues collection must be programmatically populated // with the values for the record to update. // Use the sender argument to retrieve the FormView // control that raised the event. FormView employeeFormView = (FormView)sender; // Retrieve the data row from the FormView control. FormViewRow row = employeeFormView.Row; // Retrieve the TextBox controls that contain the updated values // entered by the user. TextBox firstNameTextBox = (TextBox)row.FindControl("FirstNameTextBox"); TextBox lastNameTextBox = (TextBox)row.FindControl("LastNameTextBox"); if (firstNameTextBox != null && lastNameTextBox != null) { // Add the new values to the NewValues collections. e.NewValues.Add("FirstName", firstNameTextBox.Text); e.NewValues.Add("LastName", lastNameTextBox.Text); } } void EmployeeFormView_PageIndexChanging(Object sender, FormViewPageEventArgs e) { // Use the sender argument to retrieve the FormView // control that raised the event. FormView employeeFormView = (FormView)sender; // Cancel the paging operation if the FormView control // is in edit mode. if (employeeFormView.CurrentMode == FormViewMode.Edit) { e.Cancel = true; // Display an error message. int newPage = e.NewPageIndex + 1; MessageLabel.Text = "Please update the current record before moving to page " + newPage.ToString() + "."; } } void EmployeeFormView_ModeChanged(Object sender, EventArgs e) { // Clear the message label. MessageLabel.Text = ""; } </script> <html> <body> <form runat="server"> <h3>FormView Example</h3> <!-- Use a PlaceHolder control as the container for the --> <!-- dynamically generated FormView control. --> <asp:placeholder id="FormViewPlaceHolder" runat="server"/> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName Where [EmployeeID]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
FormViewPageEventHandler デリゲートを、宣言によって FormView コントロールの PageIndexChanging イベントに追加する方法を次の例に示します。
<%@ Page language="VB" %> <script runat="server"> Sub EmployeeFormView_PageIndexChanging(ByVal sender As Object, ByVal e As FormViewPageEventArgs) Handles EmployeeFormView.PageIndexChanging ' Cancel the paging operation if the FormView control ' is in edit mode. If EmployeeFormView.CurrentMode = FormViewMode.Edit Then e.Cancel = True ' Display an error message. Dim newPage As Integer = e.NewPageIndex + 1 MessageLabel.Text = "Please update the current record before moving to page " & _ newPage.ToString() & "." End If End Sub Sub EmployeeFormView_ModeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles EmployeeFormView.ModeChanged ' Clear the message label. MessageLabel.Text = "" End Sub </script> <html> <body> <form runat="server"> <h3>FormViewPageEventArgs Example</h3> <asp:formview id="EmployeeFormView" datasourceid="EmployeeSource" allowpaging="true" datakeynames="EmployeeID" emptydatatext="No employees found." runat="server"> <itemtemplate> <table> <tr> <td rowspan="6"> <asp:image id="EmployeeImage" imageurl='<%# Eval("PhotoPath") %>' alternatetext='<%# Eval("LastName") %>' runat="server"/> </td> <td colspan="2"> </td> </tr> <tr> <td> <b>Name:</b> </td> <td> <%# Eval("FirstName") %> <%# Eval("LastName") %> </td> </tr> <tr> <td> <b>Title:</b> </td> <td> <%# Eval("Title") %> </td> </tr> <tr> <td> <b>Hire Date:</b> </td> <td> <%# Eval("HireDate","{0:d}") %> </td> </tr> <tr height="150" valign="top"> <td> <b>Address:</b> </td> <td> <%# Eval("Address") %><br/> <%# Eval("City") %> <%# Eval("Region") %> <%# Eval("PostalCode") %><br/> <%# Eval("Country") %> </td> </tr> <tr> <td colspan="2"> <asp:linkbutton id="Edit" text="Edit" commandname="Edit" runat="server"/> </td> </tr> </table> </itemtemplate> <edititemtemplate> <table> <tr> <td rowspan="6"> <asp:image id="EmployeeEditImage" imageurl='<%# Eval("PhotoPath") %>' alternatetext='<%# Eval("LastName") %>' runat="server"/> </td> <td colspan="2"> </td> </tr> <tr> <td> <b>Name:</b> </td> <td> <asp:textbox id="FirstNameUpdateTextBox" text='<%# Bind("FirstName") %>' runat="server"/> <asp:textbox id="LastNameUpdateTextBox" text='<%# Bind("LastName") %>' runat="server"/> </td> </tr> <tr> <td> <b>Title:</b> </td> <td> <asp:textbox id="TitleUpdateTextBox" text='<%# Bind("Title") %>' runat="server"/> </td> </tr> <tr> <td> <b>Hire Date:</b> </td> <td> <asp:textbox id="HireDateUpdateTextBox" text='<%# Bind("HireDate", "{0:d}") %>' runat="server"/> </td> </tr> <tr height="150" valign="top"> <td> <b>Address:</b> </td> <td> <asp:textbox id="AddressUpdateTextBox" text='<%# Bind("Address") %>' runat="server"/> <br/> <asp:textbox id="CityUpdateTextBox" text='<%# Bind("City") %>' runat="server"/> <asp:textbox id="RegionUpdateTextBox" text='<%# Bind("Region") %>' width="40" runat="server"/> <asp:textbox id="PostalCodeUpdateTextBox" text='<%# Bind("PostalCode") %>' width="60" runat="server"/> <br/> <asp:textbox id="CountryUpdateTextBox" text='<%# Bind("Country") %>' runat="server"/> </td> </tr> <tr> <td colspan="2"> <asp:linkbutton id="UpdateButton" text="Update" commandname="Update" runat="server"/> <asp:linkbutton id="CancelButton" text="Cancel" commandname="Cancel" runat="server"/> </td> </tr> </table> </edititemtemplate> </asp:formview> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [Address], [City], [Region], [PostalCode], [Country], [HireDate], [PhotoPath] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName, [Title]=@Title, [Address]=@Address, [City]=@City, [Region]=@Region, [PostalCode]=@PostalCode, [Country]=@Country Where [EmployeeID]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <script runat="server"> void EmployeeFormView_PageIndexChanging(Object sender, FormViewPageEventArgs e) { // Cancel the paging operation if the FormView control // is in edit mode. if (EmployeeFormView.CurrentMode == FormViewMode.Edit) { e.Cancel = true; // Display an error message. int newPage = e.NewPageIndex + 1; MessageLabel.Text = "Please update the current record before moving to page " + newPage.ToString() + "."; } } void EmployeeFormView_ModeChanged(Object sender, EventArgs e) { // Clear the message label. MessageLabel.Text = ""; } </script> <html> <body> <form runat="server"> <h3>FormViewPageEventArgs Example</h3> <asp:formview id="EmployeeFormView" datasourceid="EmployeeSource" allowpaging="true" datakeynames="EmployeeID" emptydatatext="No employees found." onpageindexchanging="EmployeeFormView_PageIndexChanging" onmodechanged="EmployeeFormView_ModeChanged" runat="server"> <itemtemplate> <table> <tr> <td rowspan="6"> <asp:image id="EmployeeImage" imageurl='<%# Eval("PhotoPath") %>' alternatetext='<%# Eval("LastName") %>' runat="server"/> </td> <td colspan="2"> </td> </tr> <tr> <td> <b>Name:</b> </td> <td> <%# Eval("FirstName") %> <%# Eval("LastName") %> </td> </tr> <tr> <td> <b>Title:</b> </td> <td> <%# Eval("Title") %> </td> </tr> <tr> <td> <b>Hire Date:</b> </td> <td> <%# Eval("HireDate","{0:d}") %> </td> </tr> <tr height="150" valign="top"> <td> <b>Address:</b> </td> <td> <%# Eval("Address") %><br/> <%# Eval("City") %> <%# Eval("Region") %> <%# Eval("PostalCode") %><br/> <%# Eval("Country") %> </td> </tr> <tr> <td colspan="2"> <asp:linkbutton id="Edit" text="Edit" commandname="Edit" runat="server"/> </td> </tr> </table> </itemtemplate> <edititemtemplate> <table> <tr> <td rowspan="6"> <asp:image id="EmployeeEditImage" imageurl='<%# Eval("PhotoPath") %>' alternatetext='<%# Eval("LastName") %>' runat="server"/> </td> <td colspan="2"> </td> </tr> <tr> <td> <b>Name:</b> </td> <td> <asp:textbox id="FirstNameUpdateTextBox" text='<%# Bind("FirstName") %>' runat="server"/> <asp:textbox id="LastNameUpdateTextBox" text='<%# Bind("LastName") %>' runat="server"/> </td> </tr> <tr> <td> <b>Title:</b> </td> <td> <asp:textbox id="TitleUpdateTextBox" text='<%# Bind("Title") %>' runat="server"/> </td> </tr> <tr> <td> <b>Hire Date:</b> </td> <td> <asp:textbox id="HireDateUpdateTextBox" text='<%# Bind("HireDate", "{0:d}") %>' runat="server"/> </td> </tr> <tr height="150" valign="top"> <td> <b>Address:</b> </td> <td> <asp:textbox id="AddressUpdateTextBox" text='<%# Bind("Address") %>' runat="server"/> <br/> <asp:textbox id="CityUpdateTextBox" text='<%# Bind("City") %>' runat="server"/> <asp:textbox id="RegionUpdateTextBox" text='<%# Bind("Region") %>' width="40" runat="server"/> <asp:textbox id="PostalCodeUpdateTextBox" text='<%# Bind("PostalCode") %>' width="60" runat="server"/> <br/> <asp:textbox id="CountryUpdateTextBox" text='<%# Bind("Country") %>' runat="server"/> </td> </tr> <tr> <td colspan="2"> <asp:linkbutton id="UpdateButton" text="Update" commandname="Update" runat="server"/> <asp:linkbutton id="CancelButton" text="Cancel" commandname="Cancel" runat="server"/> </td> </tr> </table> </edititemtemplate> </asp:formview> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the Web.config file. --> <asp:sqldatasource id="EmployeeSource" selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [Address], [City], [Region], [PostalCode], [Country], [HireDate], [PhotoPath] From [Employees]" updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName, [Title]=@Title, [Address]=@Address, [City]=@City, [Region]=@Region, [PostalCode]=@PostalCode, [Country]=@Country Where [EmployeeID]=@EmployeeID" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からFormViewPageEventHandler デリゲートを検索する場合は、下記のリンクをクリックしてください。

- FormViewPageEventHandler デリゲートのページへのリンク