开发者

show popupcontrol in rowupdating event of devexpress gridview, if a certain criteria fails

开发者 https://www.devze.com 2023-02-14 19:04 出处:网络
I have a Devexpress Gridview where item and it\'s price is displayed. Editing is enabled. I use rowupdating event so inorder to check if the price updated is higher than a normal value.

I have a Devexpress Gridview where item and it's price is displayed.

Editing is enabled.

I use rowupdating event so inorder to check if the price updated is higher than a normal value.

if so, i cancel edit by

e.Cancel = true;
 ASPxGridView1.CancelEdit();

the next thing i want is to popup a aspx popupcontrol requesting a password inorder to proceed with higher amount within the rowupdating event.

the popcontrol will contain a password textbox and a button.The remaining procces will be carried out by button click function

eventhough i called popcontrol

 ASPxPopupControl2.ShowOnPageLoad = true;

the pop doesn't show up......why is this so..

here is my over all code..

 protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
    string msg;

    double new_amt = double.Parse(e.NewValues["Amount"].ToString());//-->gets new amount

    string type= e.OldValues["Type"].ToString();//-->gets the item

    double refer_amt=Misc_functions.Get_Item_Amount(type,out msg);//--this function fetches the normal amount for a particular item

    if (new_amt > refer_amt)
    {
        e.Cancel = true;
        ASPxGridView1.CancelEdit();

        ASPxPopupControl2.ShowOnPageLoad = true;

    }


}

Basically开发者_如何学JAVA i need a password authentication if an amount edited is a higher than a normal value. any ideas??


This cannot be done using the server code. The best solution is to create a custom java script variable within the RowUpdating event handler and check its value in the ASPxGridView's client side EndCallback event handler. I.e.

 protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{ ...
   gridView.JSProperties["cpShowPopup"] = true;
...
}

EndCallback = function(s,e) { 
  if(typeof(s.cpShowPopup) != 'undefined') { 
    popup.Show();
  }
}

Hope, this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消