コード例 #1
0
 protected void DetailsViewOrderItems_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
 {
     if (e.Exception != null)
     {
         e.ExceptionHandled = true;
         e.KeepInInsertMode = true;
         ValidationUtility.ShowValidationErrors(this, e.Exception);
     }
     else
     {
         if (GXGridView1.SelectedDataKey != null)
         {
             int GXgvSelectedValue = Convert.ToInt32(GXGridView1.SelectedValue);
             odsGridViewOrderItems.SelectParameters.Clear();
             odsGridViewOrderItems.SelectParameters.Add("orderID", GXgvSelectedValue.ToString());
             GridViewOrderItems.DataBind();
         }
         else
         {
             int GXgvSelectedValue = GXGridView1SelectedValue;
             odsGridViewOrderItems.SelectParameters.Clear();
             odsGridViewOrderItems.SelectParameters.Add("orderID", GXgvSelectedValue.ToString());
             GridViewOrderItems.DataBind();
         }
         mvMain.SetActiveView(viewOrderItems);
         mvOrderItems.SetActiveView(viewOrderItemsGrid);
     }
 }
コード例 #2
0
    protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        if (e.Exception != null)
        {
            e.ExceptionHandled = true;
            e.KeepInInsertMode = true;
            ValidationUtility.ShowValidationErrors(this, e.Exception);
        }
        else
        {
            GXGridView1.TotalRecords = OrdersView.SelectCountCached();
            GXGridView1.DataBind();
            //mvMain.SetActiveView(viewGrid);

            string orderNumber        = e.Values["OrderNumber"] as string;
            Broker.DataAccess.Order o = Broker.DataAccess.Order.GetByOrderNumber(orderNumber);

            string DataKeyValue = o.ID.ToString();

            int intSelectedIndex = 0;
            int intPageIndex     = 0;
            int intGridViewPages = GXGridView1.PageCount;

            // Loop thru each page in the GridView
            for (int intPage = 0; intPage < intGridViewPages; intPage++)
            {
                // Set the current GridView page
                GXGridView1.PageIndex = intPage;
                // Bind the GridView to the current page
                GXGridView1.DataBind();
                // Loop thru each DataKey in the GridView
                for (int i = 0; i < GXGridView1.DataKeys.Count; i++)
                {
                    if (Convert.ToString(GXGridView1.DataKeys[i].Value) == DataKeyValue)
                    {
                        // If it is a match set the variables and exit
                        intSelectedIndex = i;
                        intPageIndex     = intPage;
                        break;
                    }
                }
            }

            // Set the GridView to the values found
            GXGridView1.PageIndex     = intPageIndex;
            GXGridView1.SelectedIndex = intSelectedIndex;
            GXGridView1.DataBind();

            int GXgvSelectedValue = o.ID;
            GXGridView1SelectedValue = GXgvSelectedValue;
            odsOrderPreview.SelectParameters.Clear();
            odsOrderPreview.SelectParameters.Add("id", GXgvSelectedValue.ToString());
            dvOrderPreview.DataBind();
            odsGridViewOrderItems.SelectParameters.Clear();
            odsGridViewOrderItems.SelectParameters.Add("orderID", GXgvSelectedValue.ToString());
            GridViewOrderItems.DataBind();
            mvMain.SetActiveView(viewOrderItems);
            mvOrderItems.SetActiveView(viewOrderItemsGrid);
        }
    }
コード例 #3
0
    protected void btnOrderItems_Click(object sender, EventArgs e)
    {
        if (GXGridView1.SelectedIndex != -1)
        {
            if (GXGridView1.SelectedDataKey != null)
            {
                int GXgvSelectedValue = Convert.ToInt32(GXGridView1.SelectedValue);
                odsOrderPreview.SelectParameters.Clear();
                odsOrderPreview.SelectParameters.Add("id", GXgvSelectedValue.ToString());
                dvOrderPreview.DataBind();
                odsGridViewOrderItems.SelectParameters.Clear();
                odsGridViewOrderItems.SelectParameters.Add("orderID", GXgvSelectedValue.ToString());
                GridViewOrderItems.DataBind();
            }
            else
            {
                int GXgvSelectedValue = GXGridView1SelectedValue;
                odsOrderPreview.SelectParameters.Clear();
                odsOrderPreview.SelectParameters.Add("id", GXgvSelectedValue.ToString());
                dvOrderPreview.DataBind();
                odsGridViewOrderItems.SelectParameters.Clear();
                odsGridViewOrderItems.SelectParameters.Add("orderID", GXgvSelectedValue.ToString());
                GridViewOrderItems.DataBind();
            }

            mvMain.SetActiveView(viewOrderItems);
            mvOrderItems.SetActiveView(viewOrderItemsGrid);
            btnNew.CssClass         = "novZapis";
            btnEdit.CssClass        = "izmeni";
            btnPreview.CssClass     = "osvezi";
            btnReport.CssClass      = "izvestaj";
            btnSearch.CssClass      = "prebaraj";
            btnAttachments.CssClass = "dokumenti";
            btnOrderItems.CssClass  = "stavki_Active";
        }
    }
コード例 #4
0
 protected void GXGridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SingleClick")
     {
         btnEdit.Enabled        = true;
         btnOrderItems.Enabled  = true;
         btnAttachments.Enabled = true;
         int selIndex = Convert.ToInt32(e.CommandArgument);
         GXGridView1.SelectedIndex = selIndex;
         GXGridView1SelectedValue  = Convert.ToInt32(GXGridView1.SelectedValue);
         DetailsViewOrderForAttachments.DataBind();
         dvOrderPreview.DataBind();
         GridViewOrderItems.DataBind();
     }
     if (e.CommandName == "DoubleClick")
     {
         btnEdit.Enabled        = true;
         btnOrderItems.Enabled  = true;
         btnAttachments.Enabled = true;
         int selIndex = Convert.ToInt32(e.CommandArgument);
         GXGridView1.SelectedIndex = selIndex;
         mvMain.SetActiveView(viewOrderItems);
         mvOrderItems.SetActiveView(viewOrderItemsGrid);
         btnNew.CssClass          = "novZapis";
         btnEdit.CssClass         = "izmeni";
         btnPreview.CssClass      = "osvezi";
         btnReport.CssClass       = "izvestaj";
         btnSearch.CssClass       = "prebaraj";
         btnAttachments.CssClass  = "dokumenti";
         btnOrderItems.CssClass   = "stavki_Active";
         GXGridView1SelectedValue = Convert.ToInt32(GXGridView1.SelectedValue);
         DetailsViewOrderForAttachments.DataBind();
         dvOrderPreview.DataBind();
         GridViewOrderItems.DataBind();
     }
 }