Esempio n. 1
0
    protected void OdsOrderDetails_Selecting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        //since the select parameter contains a special type of parameter, rather than the primitive type
        //we can't use the built-in asp:paramter in object data-source, as it supports only primitive data types
        //for this purpose we have performed the required casting and assignment (if necessary) in this event handler method
        //however alternatively we can use 'control-parameter' in object-data-source for this type of special data type, which performs the casting automatically
        //e.InputParameters("employeeID") = CType(1,Int32)

        //saving page-mode and item id
        //int empId = (int)uint.MinValue;
        //if(e.InputParameters["employeeId"]!=null)
        //    empId =Int32.Parse(e.InputParameters["employeeId"].ToString());

        //empId = WebManager.StoreValue(this, ViewState, empId, formViewEmployee);

        // [ Added: Jalal On 03/17/2008 ]
        //e.InputParameters["employeeId"] = Int32.Parse(ViewState["Id"].ToString(), System.Globalization.CultureInfo.CurrentCulture);
        e.InputParameters["employeeId"] = WebManager.ParseItemId(this, formViewEmployee);
        //e.InputParameters["employeeId"] = Convert.ToInt32(WebManager.ParseItemId(this, formViewEmployee));
        //if the form view mode is in insert model, then we'll cancel the selection by object data source
        if (formViewEmployee.CurrentMode == FormViewMode.Insert)
        {
            e.Cancel = true;
        }
    }