wie man den Wert der ausgewählten Zeile in aspxgridview devexpress

Ich habe einen devexpress aspxgridview und ich brauche, um die ausgewählte Zeile Wert. Weiß jemand, wie man die ausgewählte Zeile den Primärschlüssel-Wert ohne postback. OnSelectionChanged event nicht ausgelöst. Wie bekomme ich den OnSelectionChanged event ausgelöst werden, ohne postback.

<dx:ASPxGridView ID="popupProductsGrid" runat="server" AutoGenerateColumns="False" Width="815px" KeyFieldName="LOGICALREF" ClientInstanceName="popupProductsGrid" 
OnSelectionChanged="popupProductsGrid_SelectionChanged" OnCustomCallback="popupProductsGrid_CustomCallback">
<Columns>
    <dx:GridViewDataTextColumn Caption="KOD" FieldName="URUNKOD" ShowInCustomizationForm="True" VisibleIndex="1" Width="100px">
    </dx:GridViewDataTextColumn>
    <dx:GridViewDataTextColumn Caption="AÇIKLAMA" FieldName="URUN" ShowInCustomizationForm="True" VisibleIndex="2" Width="250px">
    </dx:GridViewDataTextColumn>
    <dx:GridViewDataTextColumn Caption="STOK" FieldName="MIKTAR" ShowInCustomizationForm="True" VisibleIndex="3" Width="50px">
    </dx:GridViewDataTextColumn>
    <dx:GridViewDataTextColumn Caption="LOGICALREF" FieldName="LOGICALREF" ShowInCustomizationForm="True" VisibleIndex="0" Visible="False" Width="100px">
    </dx:GridViewDataTextColumn>
    <dx:GridViewDataTextColumn Caption="BİRİM" FieldName="ANABIRIM" ShowInCustomizationForm="True" VisibleIndex="4" Width="40px">
    </dx:GridViewDataTextColumn>

    </Columns>
    <SettingsBehavior AllowFocusedRow="True" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
    <Settings ShowFilterRow="True" />
    <SettingsText EmptyDataRow="Listelenecek Kayıt Bulunamadı" />
    </dx:ASPxGridView>


protected void popupProductsGrid_SelectionChanged(object sender, EventArgs e)
    {
        DataRow dr = popupProductsGrid.GetDataRow(popupProductsGrid.FocusedRowIndex);
        Session["stok_kodu"] = dr[0].ToString();
    }

Eine weitere Sache, die ich nicht wollen, es zu postback. Also habe ich versucht alternative Möglichkeiten, wie HtmlRowPrepared und CustomCallback.

  protected void popupProductsGrid_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
    {
        if (e.KeyValue != null)
        {
            string parameter = e.KeyValue.ToString();
            e.Row.Attributes.Add("onclick", "popupProductsGrid.PerformCallback('" + parameter + "')");
        }
    }

    protected void popupProductsGrid_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
    {
        if (e.Parameters != "")
        {
            Session["stok_kodu"] = e.Parameters;
        }
    }
  • event doesnt get triggered. Set AutoPostBack zu true.. ?
  • aber ich möchte nicht, dass es zu postback.
  • Ohne postback wird es nicht aktualisiert. Sie können es in AjaxUpdatePanel wird es asynchron aktualisieren Sie die gridview.
InformationsquelleAutor Arif YILMAZ | 2014-10-25
Schreibe einen Kommentar