Friday, 24 August 2012

few important events of ASPxGridView..............

//How to set selection by c# code...................................................................................................
protected void AssetsListGrid_SetSelection(object sender, ASPxGridViewDetailRowEventArgs e)
{
 

if (AssetListGrid.Selection.IsRowSelected(e.VisibleIndex)){
AssetListGrid.Selection.SetSelection(e.VisibleIndex,
false);AssetListGrid.DataBind();
}

else{
AssetListGrid.Selection.SetSelection(e.VisibleIndex,
true);AssetListGrid.DataBind();




// How to get keyvalue of Master Grid OnBeforeDataSelectionPerform By Inner Grid.............................
protected void detailGrid_DataSelect(object sender, EventArgs e){

String ID = (sender as ASPxGridView).GetMasterRowKeyValue().ToString();Session[
"DisplayID"] = ID;
}



// How to get ASPxGridView fieldvalues OnRowComman Click..................................
//ASPx File
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" KeyFieldName="QuotationID" OnRowCommand="ASPxGridView1_RowCommand"><Settings ShowFilterRow="True" />

<dx:GridViewDataTextColumn FieldName="BlockQuotation" VisibleIndex="9"><DataItemTemplate><asp:LinkButton ID="BlockQuotation" runat="server" CommandName="BlockQuotation" Text="BlockQuotation">Block Quotation
</asp:LinkButton></DataItemTemplate></dx:GridViewDataTextColumn>



protected void ASPxGridView1_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e){
Session[
"QuotationID"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "QuotationID").ToString();Session[
"ClientID"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "ClientID").ToString();Session[
"ClientCompanyName"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "ClientCompanyName").ToString();
//Session["FNameClientContact"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "FNameClientContact").ToString();//Session["LNameClientContact"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "LNameClientContact").ToString();Session["ClientEmailID"] = ASPxGridView1.GetRowValuesByKeyValue(e.KeyValue, "ClientEmailID").ToString();Response.Redirect(
"BlockQuotation.aspx"); 
}

No comments:

Post a Comment