This is a migrated thread and some comments may be shown as answers.

Selecting data from multiple Grids

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Neergaard
Top achievements
Rank 2
Daniel Neergaard asked on 09 Nov 2008, 12:43 AM
Hi,
I'm trying to build a method so that when i fire my select command from one grid it will take the data from the other grid aswell.

protected void gvSuppliers_ToCart(Object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "AddToCart")
        {
            //ProductGrid "gvDetails"
            _productName = Convert.ToString(gvDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ProductName"]);
            _productDescription = Convert.ToString(gvDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ProductDescription"]);
            _ean = Convert.ToInt32(gvDetails.MasterTableView.DataKeyValues[e.Item.ItemIndex]["EAN"]);

            //SupplierGrid "gvSuppliers"
            _supplierName = Convert.ToString(gvSuppliers.MasterTableView.DataKeyValues[e.Item.ItemIndex]["SupplierName"]);
            _price = Convert.ToDouble(gvSuppliers.MasterTableView.DataKeyValues[e.Item.ItemIndex]["Price"]);
            }
        }
    }

Now, i'm now quite sure if both grids should have the same "OnItemCommand" or if I could just call it from my SupplierGrid. Please help, need this done by tuesday :S

Atm i'm just getting:

[ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2132776
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +32
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


which is not really the most helpful stack trace :(

1 Answer, 1 is accepted

Sort by
0
Daniel Neergaard
Top achievements
Rank 2
answered on 09 Nov 2008, 09:19 PM
Solved the problem by changing my ButtonType="PushButton" to LinkButton. Apparently the ImageButton option also causes this exception.

My RadControls are Q2 2008
Tags
Grid
Asked by
Daniel Neergaard
Top achievements
Rank 2
Answers by
Daniel Neergaard
Top achievements
Rank 2
Share this question
or