Forum: ASP.NET2.0 |
Thema:
AW: AW: AW: Gridview - Viewstateproblem |
Von:
Hannes Preishuber (
02.12.2006 15:17) |
da ich das so noch nicht gemacht habe habe ich das mal ausprobiert
und es scheint zu gehen
[%@ Page Language="VB" %>
[!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[script runat="server">
Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
e.Row.BackColor = Drawing.Color.Beige
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
MultiView1.ActiveViewIndex = RadioButtonList1.SelectedValue
End Sub
[/script>
[html xmlns="http://www.w3.org/1999/xhtml" >
[head runat="server">
[title>Unbenannte Seite[/title>
[/head>
[body>
[form id="form1" runat="server">
[div>
[asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
[asp:ListItem>0[/asp:ListItem>
[asp:ListItem>1[/asp:ListItem>
[/asp:RadioButtonList>[br />
[asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
[asp:View ID="View1" runat="server">
[asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" OnRowCreated="GridView1_RowCreated">
[Columns>
[asp:CommandField ShowEditButton="True" />
[asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" />
[asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" />
[asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" />
[asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" />
[/Columns>
[/asp:GridView>
[asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="[%$ ConnectionStrings:NorthwindConnectionString %>"
DeleteCommand="DELETE FROM [Customers] WHERE [CustomerID] = @CustomerID" InsertCommand="INSERT INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle]) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle)"
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]"
UpdateCommand="UPDATE [Customers] SET [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle WHERE [CustomerID] = @CustomerID">
[DeleteParameters>
[asp:Parameter Name="CustomerID" Type="String" />
[/DeleteParameters>
[UpdateParameters>
[asp:Parameter Name="CompanyName" Type="String" />
[asp:Parameter Name="ContactName" Type="String" />
[asp:Parameter Name="ContactTitle" Type="String" />
[asp:Parameter Name="CustomerID" Type="String" />
[/UpdateParameters>
[InsertParameters>
[asp:Parameter Name="CustomerID" Type="String" />
[asp:Parameter Name="CompanyName" Type="String" />
[asp:Parameter Name="ContactName" Type="String" />
[asp:Parameter Name="ContactTitle" Type="String" />
[/InsertParameters>
[/asp:SqlDataSource>
[/asp:View>
[asp:View ID="View2" runat="server">
zwei[/asp:View>
[/asp:MultiView> [/div>
[/form>
[/body>
[/html>
-Hannes
Betreff |
Von |
Datum |
|
|
AW: AW: AW: AW: Gridview - Viewstateproblem
Hallo Hannes!<br><br>Danke fürs ausprobieren. Ist nur eine gute Frage wieso es bei mir nicht pfeift.<br><br>Hab gerade mal extra e.Row.BackColor versucht. Hat aber nichts geändert. ;-(<br><br>Werd mal eine... |
|
|
|
|
|
Bernhard
Grojer
|
04.12.2006 11:25 |
|
|
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!