How to set SelectedRow values in Gridpanel, Ext.Net C# ??

  1. #1

    How to set SelectedRow values in Gridpanel, Ext.Net C# ??

    The following is my GridPanel codes :

    protected void Row_Click(object sender, DirectEventArgs e)
        string id = e.ExtraParams["id"];
        if (string.IsNullOrEmpty(id))
        int messageID = int.Parse(id);
        KMSServiceClient kmsServiceClient = new KMSServiceClient();
        Messages messages = kmsServiceClient.GetMessageByID(messageID);
        Window win = new Window
            ID = "Window" + messages.Id,
            Title = messages.Subject,
            Height = 300,
            Width = 400,
            Padding = 5,
            Html = messages.Body,
            StyleSpec = "direction:rtl;",
            Modal = true
        RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;
        sm.Set("", "new");//For changing the Subject value **********
    <ext:Store ID="stoMaster" runat="server" OnRefreshData="gpMaster_RefreshData">
            <ext:JsonReader IDProperty="Id">
                    <ext:RecordField Name="ID" Type="Int" />
                    <ext:RecordField Name="Subject" />
                    <ext:RecordField Name="Sender" />
                    <ext:RecordField Name="ReceiveDate" />
    <ext:GridPanel ID="GridPanel1" runat="server" Title="list of Messages" StripeRows="true"
        AutoWidth="true" TrackMouseOver="true" Height="330" StoreID="stoMaster" AutoEncode="true">
        <ColumnModel ID="ColumnModel1" runat="server">
                <ext:Column ColumnID="ID" Header="ID" Width="50" DataIndex="ID" Resizable="false"
                    MenuDisabled="true" Fixed="true" Align="Right" />
                <ext:Column ColumnID="Subject" Header="Subject" DataIndex="Subject" Align="Right"
                <ext:Column Header="Sender" DataIndex="Sender" Width="100" Align="Right">
                <ext:Column Header="Date" DataIndex="ReceiveDate" Align="Right" Width="100">
                <ext:ImageCommandColumn Width="60" Align="Right" Css="text-align:center;" Sortable="false">
                        <ext:ImageCommand CommandName="Reply" Icon="ApplicationGo" Text="reply">
                <ext:ImageCommandColumn Width="60" Align="Right" Css="text-align:center;" Sortable="false">
                        <ext:ImageCommand CommandName="Show" Icon="ApplicationViewTile" Text="show">
                <ext:ImageCommandColumn Width="60" Align="Center" Css="text-align:center;" Sortable="false">
                        <ext:ImageCommand CommandName="Delete" Icon="Delete" Text="Delete">
            <Command OnEvent="Command">
                <EventMask ShowMask="true"></EventMask>
                    <ext:Parameter Name="id" Value="" Mode="Raw" />
                    <ext:Parameter Name="command" Value="command" Mode="Raw" />
                <Confirmation BeforeConfirm="if (command!='Delete') return false;" ConfirmRequest="true"
                    Message="Are u sure ?" Title="Attention" />
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                    <RowSelect OnEvent="Row_Click">
                        <EventMask ShowMask="true"></EventMask>
                            <ext:Parameter Name="id" Value="" Mode="Raw" />
            <ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="10" StoreID="stoMaster"
                EmptyMsg="&nbsp;" DisplayMsg="&nbsp;" BeforePageText="Page" Cls="LTR" />
    as you can see, I wanna change the SelctedRow's Subject Cell to `New`.
    But it doesn't work !!!

    Could you please guide me ?
    How can I change a value in a GridPanel's Cell with C# ?
  2. #2

    Please use:
    RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
    this.GridPanel1.GetStore().UpdateRecordField((object)sm.SelectedRow.RecordID, "Subject", "new");
  3. #3


    Thanks my fiend
    Last edited by Mohammad; Oct 31, 2011 at 5:39 AM.

Similar Threads

  1. [CLOSED] GridPanel : SelectedRow is always NULL?
    By wagger in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 06, 2011, 4:46 AM
  2. [CLOSED] Reading SelectedRow Column values
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 09, 2010, 10:51 AM
  3. Replies: 1
    Last Post: Oct 12, 2010, 9:50 AM
  4. Replies: 1
    Last Post: Jun 19, 2009, 10:55 AM
  5. Replies: 1
    Last Post: Oct 30, 2008, 5:57 AM

Tags for this Thread

Posting Permissions