Question

I'm using a Ext.Net GridPanel in a web page i have designed. Once this GridPanel is populated with data, and i click a row, i would like information pertaining to that row to be forwarded to the Ext.Net ExtraParams. Currently, there is a column with button added to each row with data. When this button is clicked, it then passed record data to the defined handler. Below is the ASPX code for this column button i mentioned:

<DirectEvents>
    <Command OnEvent="GridPanel1_Command">
         <EventMask ShowMask="true" />
         <ExtraParams>
            <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="command" Value="command" Mode="Raw">
            </ext:Parameter>
         </ExtraParams>
    </Command>
</DirectEvents>

And the C# handler it points to:

protected void GridPanel1_Command(object sender, DirectEventArgs e)
{
        string commandName = e.ExtraParams["command"];
        string Id = e.ExtraParams["Id"];
}

This code works perfectly fine.

I want to add a double click handler now for when a row is double clicked, it forwards the same data, so i implemented the following:

<DirectEvents>
    <Command OnEvent="GridPanel1_Command">
         <EventMask ShowMask="true" />
         <ExtraParams>
            <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="command" Value="command" Mode="Raw">
            </ext:Parameter>
         </ExtraParams>
    </Command>
    <DblClick OnEvent="GridPanel1_DblClick">
          <ExtraParams>
              <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw">
              </ext:Parameter>
          </ExtraParams>
    </DblClick>
</DirectEvents>

With the following C# handler:

protected void GridPanel1_DblClick(object sender, DirectEventArgs e)
{
   string Id = e.ExtraParams["Id"];
}

GridPanel1_DblClick never gets fired on a double click of a row item, however if i remove the ext:Parameter attribute it fires perfectly normal.

I need to obtain the row data that was clicked, what is wrong with my code?

Let me know if i can provide anything else, i am an ASP.Net novice, but a C# pro...

Was it helpful?

Solution

I did tons of research regarding this issue before i posted this question, but apparently not enough. I have found the answer from a related post:

How to get values from the currently selected row within a Ext.Net.GridPanel outside of the SelectionModel?

I changed:

<DblClick OnEvent="GridPanel1_DblClick">
      <ExtraParams>
          <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw">
          </ext:Parameter>
      </ExtraParams>
</DblClick>

To

<RowDblClick OnEvent="GridPanel1_DblClick">
      <ExtraParams>
          <ext:Parameter Name="Id" Value="this.selModel.getSelected().data.Id" Mode="Raw">
          </ext:Parameter>
      </ExtraParams>
</RowDblClick>

The planets are now aligned...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top