PDA

View Full Version : [CLOSED] ImageCommand with DirectEvent



Adrian
Mar 09, 2012, 10:33 AM
Hi,
The following code worked fine with Ext.Net 2.0 DP1 ... can you let me know where I'm going wrong now please (thanks).
Error: Object reference not set to an instance of an object.


Code Behind:


protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.GridPanel1.Store.Primary.DataSource = new object[]
{
new object[] { 1, "3m Co" },
new object[] { 2, "Alcoa Inc" },
new object[] { 3, "Altria Group Inc" },
new object[] { 4, "American Express Company" },
new object[] { 5, "American International Group, Inc." },
};


this.GridPanel1.Store.Primary.DataBind();
}
}




protected void GridPanel1_Command(object sender, DirectEventArgs e)
{
X.MessageBox.Alert("Click", e.ExtraParams["Param"]).Show();
}






<ext:GridPanel
ID="GridPanel1"
runat="server">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="id">
<Fields>
<ext:ModelField Name="id" Type="Int" />
<ext:ModelField Name="company" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:ImageCommandColumn ID="ImageCommandColumn1" runat="server">
<Commands>
<ext:ImageCommand CommandName="Edit" Text="Edit" />
</Commands>
<DirectEvents>
<Command OnEvent="GridPanel1_Command">
<ExtraParams>
<ext:Parameter Name="id" Value="record.id" Mode="Raw"/>
</ExtraParams>
</Command>
</DirectEvents>
</ext:ImageCommandColumn>
<ext:Column ID="Column1" runat="server" Text="Company" DataIndex="company" Flex="1" />
</Columns>
</ColumnModel>
</ext:GridPanel>

Daniil
Mar 09, 2012, 1:51 PM
Hi,

Thanks for the report, fixed in SVN. Please update from:
http://svn.ext.net/premium/branches/2.0/

It will be publicly available in Beta 2.

Adrian
Mar 10, 2012, 7:54 AM
Thanks Daniil ... I can confirm the SVN update works fine. You can close this thread.

Adrian.