Hi,
I downloaded your web controls for evaluation. Specifically I'm interested in the grid for 'Excel Style' editing. I feel dumb because I can't get the simplest functionality to work. I created an empty web site, put the grid and a post back button on the default form. Changed the FullRowMode property to false, added a read only 'key' text box column, an editable text box column, then bound some data from a table to it. The display works fine. I tried the paging, reordering columns, etc this all seems good. However, when I change the editable column in a row and click my button to cause a post back I get :
Server Error in '/TESTEO' Application.
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.]
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +377
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
System.Web.UI.Page.LoadAllState() +312
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +747
I've done ASP.net for a while but confess to being no expert on viewstate so it may be just someting i have set wrong. I DON'T get the error if I hit the button causing post back without changing anything.
SO I went to plan B. I set EnableViewstate to false on the grid control and ran it that way. I don't get the error but the 'ChangedItems' count is 0 no matter how many items I change. Is this because of viewstate??? Below is the code as simple as I could make it. Any help would be appreciated as it sounds like it will be exactly what I'm looking for if I can get it working.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>
<!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 runat="server">
<title></title>
</head>
<form id="form1" runat="server">
<div>
<eo:Grid ID="Grid1" runat="server" BorderColor="#828790" BorderWidth="1px"
ColumnHeaderAscImage="00050204" ColumnHeaderDescImage="00050205"
ColumnHeaderDividerImage="00050203" ColumnHeaderHeight="24"
FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma"
Font-Overline="False" Font-Size="8.75pt" Font-Strikeout="False"
Font-Underline="False" FullRowMode="False" GridLineColor="240, 240, 240"
GridLines="Both" Height="200px" ItemHeight="19" Width="380px">
<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-image: url(00050206); background-repeat: repeat-x" />
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
<CellStyle CssText="padding-left:8px;padding-top:2px;white-space:nowrap;" />
</eo:GridItemStyleSet>
</ItemStyles>
<ColumnHeaderStyle CssText="background-image:url('00050201');padding-left:8px;padding-top:4px;" />
<ColumnHeaderHoverStyle CssText="background-image:url('00050202');padding-left:8px;padding-top:4px;" />
<Columns>
<eo:TextBoxColumn DataField="Number" HeaderText="Number" Name=""
ReadOnly="True">
</eo:TextBoxColumn>
<eo:TextBoxColumn DataField="Description" HeaderText="Description">
</eo:TextBoxColumn>
</Columns>
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
</eo:Grid>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</html>
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
Dim wrksqlstm As String = ""
wrksqlstm = "Select Number, Description from SKU"
Dim conn As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("WebOrdersConnection").ToString)
Dim ds As New System.Data.DataSet
Dim da As New System.Data.SqlClient.SqlDataAdapter(wrksqlstm, conn)
da.Fill(ds, "Item")
Grid1.DataSource = ds.Tables(0)
Grid1.DataBind()
End Sub
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Response.Write(Grid1.ChangedItems.Count & " Rows Changed")
End Sub
End Class