V
viktor
I am having a problem cahnging default mode in the code.What i am trying to
do is: on page load event:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Page.IsPostBack Then
itemview.DefaultMode = DetailsViewMode.ReadOnly
Else
itemview.DefaultMode = DetailsViewMode.Insert
End If
End Sub
i have a txt box and when i change a value and hit enter to post back it
doesn't change the mode on detailsview.
here my aspx code:
<%@ Page Language="VB" MasterPageFile="~/AppMaster.master"
AutoEventWireup="false" CodeFile="Inventory_entry.aspx.vb"
Inherits="admin_customer_Inventory_entry" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainCopy" Runat="Server">
<br />Item Id:
<asp:TextBox ID="itemID" runat="server" Text='<%# Bind("item_id") %>'
AutoPostBack="True"></asp:TextBox> <asp:Button
ID="Button1" runat="server" Text="Button" /><br />
<br />
<aspetailsView ID="itemview" runat="server" AutoGenerateRows="False"
DataKeyNames="inv_mast_uid"
DataSourceID="inventoryateset" Height="50px" Width="219px">
<Fields>
<asp:BoundField DataField="inv_mast_uid" HeaderText="inv_mast_uid"
InsertVisible="False"
ReadOnly="True" SortExpression="inv_mast_uid" />
<asp:BoundField DataField="item_id" HeaderText="item_id"
SortExpression="item_id" />
<asp:BoundField DataField="item_description" HeaderText="item_description"
SortExpression="item_description" />
<asp:BoundField DataField="qty_on_hand" HeaderText="qty_on_hand"
SortExpression="qty_on_hand" />
<asp:BoundField DataField="uom" HeaderText="uom" SortExpression="uom" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="inventoryateset" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:KeaneConnectionString %>"
DeleteCommand="DELETE FROM [inventory] WHERE [inv_mast_uid] =
@original_inv_mast_uid AND [item_id] = @original_item_id AND
[item_description] = @original_item_description AND [qty_on_hand] =
@original_qty_on_hand AND [uom] = @original_uom"
InsertCommand="INSERT INTO [inventory] ([item_id], [item_description],
[qty_on_hand], [uom]) VALUES (@item_id, @item_description, @qty_on_hand,
@uom)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM
[inventory] WHERE ([item_id] = @item_id)"
UpdateCommand="UPDATE [inventory] SET [item_id] = @item_id,
[item_description] = @item_description, [qty_on_hand] = @qty_on_hand, [uom]
= @uom WHERE [inv_mast_uid] = @original_inv_mast_uid AND [item_id] =
@original_item_id AND [item_description] = @original_item_description AND
[qty_on_hand] = @original_qty_on_hand AND [uom] = @original_uom">
<DeleteParameters>
<asparameter Name="original_inv_mast_uid" Type="Int32" />
<asparameter Name="original_item_id" Type="String" />
<asparameter Name="original_item_description" Type="String" />
<asparameter Name="original_qty_on_hand" Type="Decimal" />
<asparameter Name="original_uom" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="item_id" Type="String" />
<asparameter Name="item_description" Type="String" />
<asparameter Name="qty_on_hand" Type="Decimal" />
<asparameter Name="uom" Type="String" />
<asparameter Name="original_inv_mast_uid" Type="Int32" />
<asparameter Name="original_item_id" Type="String" />
<asparameter Name="original_item_description" Type="String" />
<asparameter Name="original_qty_on_hand" Type="Decimal" />
<asparameter Name="original_uom" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="itemID" Name="item_id" PropertyName="Text"
Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="item_id" Type="String" />
<asparameter Name="item_description" Type="String" />
<asparameter Name="qty_on_hand" Type="Decimal" />
<asparameter Name="uom" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="leftColumn" Runat="Server">
</asp:Content>
ANY HELP PLEASE
do is: on page load event:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Page.IsPostBack Then
itemview.DefaultMode = DetailsViewMode.ReadOnly
Else
itemview.DefaultMode = DetailsViewMode.Insert
End If
End Sub
i have a txt box and when i change a value and hit enter to post back it
doesn't change the mode on detailsview.
here my aspx code:
<%@ Page Language="VB" MasterPageFile="~/AppMaster.master"
AutoEventWireup="false" CodeFile="Inventory_entry.aspx.vb"
Inherits="admin_customer_Inventory_entry" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainCopy" Runat="Server">
<br />Item Id:
<asp:TextBox ID="itemID" runat="server" Text='<%# Bind("item_id") %>'
AutoPostBack="True"></asp:TextBox> <asp:Button
ID="Button1" runat="server" Text="Button" /><br />
<br />
<aspetailsView ID="itemview" runat="server" AutoGenerateRows="False"
DataKeyNames="inv_mast_uid"
DataSourceID="inventoryateset" Height="50px" Width="219px">
<Fields>
<asp:BoundField DataField="inv_mast_uid" HeaderText="inv_mast_uid"
InsertVisible="False"
ReadOnly="True" SortExpression="inv_mast_uid" />
<asp:BoundField DataField="item_id" HeaderText="item_id"
SortExpression="item_id" />
<asp:BoundField DataField="item_description" HeaderText="item_description"
SortExpression="item_description" />
<asp:BoundField DataField="qty_on_hand" HeaderText="qty_on_hand"
SortExpression="qty_on_hand" />
<asp:BoundField DataField="uom" HeaderText="uom" SortExpression="uom" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
</aspetailsView>
<asp:SqlDataSource ID="inventoryateset" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:KeaneConnectionString %>"
DeleteCommand="DELETE FROM [inventory] WHERE [inv_mast_uid] =
@original_inv_mast_uid AND [item_id] = @original_item_id AND
[item_description] = @original_item_description AND [qty_on_hand] =
@original_qty_on_hand AND [uom] = @original_uom"
InsertCommand="INSERT INTO [inventory] ([item_id], [item_description],
[qty_on_hand], [uom]) VALUES (@item_id, @item_description, @qty_on_hand,
@uom)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM
[inventory] WHERE ([item_id] = @item_id)"
UpdateCommand="UPDATE [inventory] SET [item_id] = @item_id,
[item_description] = @item_description, [qty_on_hand] = @qty_on_hand, [uom]
= @uom WHERE [inv_mast_uid] = @original_inv_mast_uid AND [item_id] =
@original_item_id AND [item_description] = @original_item_description AND
[qty_on_hand] = @original_qty_on_hand AND [uom] = @original_uom">
<DeleteParameters>
<asparameter Name="original_inv_mast_uid" Type="Int32" />
<asparameter Name="original_item_id" Type="String" />
<asparameter Name="original_item_description" Type="String" />
<asparameter Name="original_qty_on_hand" Type="Decimal" />
<asparameter Name="original_uom" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="item_id" Type="String" />
<asparameter Name="item_description" Type="String" />
<asparameter Name="qty_on_hand" Type="Decimal" />
<asparameter Name="uom" Type="String" />
<asparameter Name="original_inv_mast_uid" Type="Int32" />
<asparameter Name="original_item_id" Type="String" />
<asparameter Name="original_item_description" Type="String" />
<asparameter Name="original_qty_on_hand" Type="Decimal" />
<asparameter Name="original_uom" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="itemID" Name="item_id" PropertyName="Text"
Type="String" />
</SelectParameters>
<InsertParameters>
<asparameter Name="item_id" Type="String" />
<asparameter Name="item_description" Type="String" />
<asparameter Name="qty_on_hand" Type="Decimal" />
<asparameter Name="uom" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="leftColumn" Runat="Server">
</asp:Content>
ANY HELP PLEASE