Sep 13, 2008, 6:32 PM
[CLOSED] Possible bugs?
Hi guys,
I'm found something that sounds like a bug but I'm not sure it is. I think its me doing something awfully wrong :)
I have a BorderLayout with two regions, Center and South.
In the Center I have a GridPanel and in the South I have a set of controls to display data based on the row i have selected.
In order to do this I use an AjaxEvent and a UserParameter. When a row is selected, the event is fired, I catch the parameter and update the data contained on the controls in the southern region.
Now the problem I having is weird. The controls I have in the southern region are two, a TextField and a TextArea. If both controls have the property Disabled="false", I have no problem at all, but if i set Disabled="true" on the TextArea, i get an exception when a new row is selected and even before reaching my method...
This is the exception that's beign raised: Object reference not set to an instance of an object.
And this is the trace:
In this sample, I don't get an exception when I select a new row. Instead, nothing is being updated in the TextArea when I set its Text property in the GridPanel1_RowSelectedChanged methos.
The Textfield is being updated but the TextArea is not! O.o
Really estrange.
Anyway, here is my sample. Help :)
Thanks,
Pablo
I'm found something that sounds like a bug but I'm not sure it is. I think its me doing something awfully wrong :)
I have a BorderLayout with two regions, Center and South.
In the Center I have a GridPanel and in the South I have a set of controls to display data based on the row i have selected.
In order to do this I use an AjaxEvent and a UserParameter. When a row is selected, the event is fired, I catch the parameter and update the data contained on the controls in the southern region.
Now the problem I having is weird. The controls I have in the southern region are two, a TextField and a TextArea. If both controls have the property Disabled="false", I have no problem at all, but if i set Disabled="true" on the TextArea, i get an exception when a new row is selected and even before reaching my method...
This is the exception that's beign raised: Object reference not set to an instance of an object.
And this is the trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Coolite.Ext.Web.TextArea.set_Text(String value) +49
Coolite.Ext.Web.TextArea.LoadPostData(String postDataKey, NameValueCollection postCollection) +137
Coolite.Ext.Web.Field.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +42
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
Now it's getting even weirder. I was trying to adapt an example that Vlad gave me on something else to show you guys what the error was. But what I found is ANOTHER problem that i definitely think is related to the first want and is what makes me think maybe I'm the one doing something wrong.In this sample, I don't get an exception when I select a new row. Instead, nothing is being updated in the TextArea when I set its Text property in the GridPanel1_RowSelectedChanged methos.
The Textfield is being updated but the TextArea is not! O.o
Really estrange.
Anyway, here is my sample. Help :)
Thanks,
Pablo
<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.MyData.DataSource = new object[]
{
new object[] {"3m Co", 71.72, 0.02, 0.03, "9/1 12:00am"},
new object[] {"Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am"},
new object[] {"Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am"}
};
this.MyData.DataBind();
}
}
protected void GridPanel1_RowSelectedChanged(object sender, AjaxEventArgs e)
{
if (!String.IsNullOrEmpty(e.UserParams["Company"]))
{
this.TextArea1.Text = e.UserParams["Company"];
this.TextField1.Text = e.UserParams["Company"];
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Coolite Example - Simple Array Grid</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" StateProvider="None" />
<h1>Array Grid Example</h1>
<p>This example shows how to create a grid from Array data.</p>
<ext:Store ID="MyData" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="company" />
<ext:RecordField Name="price" Type="Float" />
<ext:RecordField Name="change" Type="Float" />
<ext:RecordField Name="pctChange" Type="Float" />
<ext:RecordField Name="lastChange" Type="Date" DateFormat="n/j h:ia" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:Panel ID="Panel1" runat="server" Height="580">
<Content>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<Center>
<ext:Panel ID="Panel2" runat="server" Title="Center">
<Content>
<ext:GridPanel
ID="GridPanel1"
runat="server"
StoreID="MyData"
Title="Array Grid"
AutoExpandColumn="Company"
AutoWidth="true"
Height="350">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnId="Company" Header="Company" Width="160" Sortable="true" DataIndex="company" />
<ext:Column Header="Price" Width="75" Sortable="true" DataIndex="price">
<Renderer Format="UsMoney" />
</ext:Column>
</Columns>
</ColumnModel>
<SelModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
<AjaxEvents>
<RowSelect OnEvent="GridPanel1_RowSelectedChanged">
<UserParams>
<ext:Parameter Name="Company" Value="this.getSelected().data['company']" Mode="Raw" />
</UserParams>
<EventMask ShowMask="false" />
</RowSelect>
</AjaxEvents>
</ext:RowSelectionModel>
</SelModel>
</ext:GridPanel>
</Content>
</ext:Panel>
</Center>
<South Collapsible="true" Split="true">
<ext:Panel ID="Panel3" runat="server" Height="150" Title="South">
<Content>
area <ext:TextArea ID="TextArea1" runat="server"></ext:TextArea><br />
field <ext:TextField ID="TextField1" runat="server"></ext:TextField>
</Content>
</ext:Panel>
</South>
</ext:BorderLayout>
</Content>
</ext:Panel>
</form>
</body>
</html>