DetailsViewModeEventArgs.NewMode プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As DetailsViewModeEventArgs Dim value As DetailsViewMode value = instance.NewMode instance.NewMode = value
public: property DetailsViewMode NewMode { DetailsViewMode get (); void set (DetailsViewMode value); }
/** @property */ public DetailsViewMode get_NewMode () /** @property */ public void set_NewMode (DetailsViewMode value)
public function get NewMode () : DetailsViewMode public function set NewMode (value : DetailsViewMode)
DetailsViewMode 列挙値の 1 つ。

NewMode プロパティを使用して、DetailsView コントロールの変更後のモードを確認します。たとえば、変更後のモードに基づいて DetailsView コントロールを構成できます。また、このプロパティを DetailsViewMode 列挙値のいずれかに設定することによって、DetailsView コントロールの変更後のモードを指定することもできます。

NewMode プロパティを使用して、DetailsView コントロールの移行後のモードを確認する方法のコード例を次に示します。
<%@ Page language="VB" autoeventwireup="false" %> <script runat="server"> Sub CustomerDetailsView_ModeChanging(ByVal sender As Object, ByVal e As DetailsViewModeEventArgs) Handles CustomerDetailsView.ModeChanging ' Use the NewMode property to determine the mode to which the ' DetailsView control is transitioning. Select Case e.NewMode Case DetailsViewMode.Edit ' Hide the pager row and clear the Label control ' when transitioning to edit mode. CustomerDetailsView.AllowPaging = False MessageLabel.Text = "" Case DetailsViewMode.ReadOnly ' Display the pager row and confirmation message ' when transitioning to edit mode. CustomerDetailsView.AllowPaging = True If e.CancelingEdit Then MessageLabel.Text = "Update canceled." Else MessageLabel.Text = "Update completed." End If Case DetailsViewMode.Insert ' Cancel the mode change if the DetailsView ' control attempts to transition to insert ' mode. e.Cancel = True Case Else MessageLabel.Text = "Unsupported mode." End Select End Sub </script> <html> <body> <form runat="server"> <h3>DetailsViewModeEventArgs Example</h3> <asp:detailsview id="CustomerDetailsView" datasourceid="DetailsViewSource" datakeynames="CustomerID" autogeneraterows="true" autogenerateeditbutton="true" allowpaging="true" runat="server"> </asp:detailsview> <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="DetailsViewSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" updatecommand="Update [Customers] Set [CompanyName]=@CompanyName, [Address]=@Address, [City]=@City, [PostalCode]=@PostalCode, [Country]=@Country Where [CustomerID]=@CustomerID" connectionstring= "<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <script runat="server"> void CustomerDetailsView_ModeChanging(Object sender, DetailsViewModeEventArgs e) { // Use the NewMode property to determine the mode to which the // DetailsView control is transitioning. switch (e.NewMode) { case DetailsViewMode.Edit: // Hide the pager row and clear the Label control // when transitioning to edit mode. CustomerDetailsView.AllowPaging = false; MessageLabel.Text = ""; break; case DetailsViewMode.ReadOnly: // Display the pager row and confirmation message // when transitioning to edit mode. CustomerDetailsView.AllowPaging = true; if (e.CancelingEdit) { MessageLabel.Text = "Update canceled."; } else { MessageLabel.Text = "Update completed."; } break; case DetailsViewMode.Insert: // Cancel the mode change if the DetailsView // control attempts to transition to insert // mode. e.Cancel = true; break; default: MessageLabel.Text = "Unsupported mode."; break; } } </script> <html> <body> <form runat="server"> <h3>DetailsViewModeEventArgs Example</h3> <asp:detailsview id="CustomerDetailsView" datasourceid="DetailsViewSource" datakeynames="CustomerID" autogeneraterows="true" autogenerateeditbutton="true" allowpaging="true" onmodechanging="CustomerDetailsView_ModeChanging" runat="server"> </asp:detailsview> <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="DetailsViewSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" updatecommand="Update [Customers] Set [CompanyName]=@CompanyName, [Address]=@Address, [City]=@City, [PostalCode]=@PostalCode, [Country]=@Country Where [CustomerID]=@CustomerID" 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に収録されているすべての辞書からDetailsViewModeEventArgs.NewMode プロパティを検索する場合は、下記のリンクをクリックしてください。

- DetailsViewModeEventArgs.NewMode プロパティのページへのリンク