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

Schedule Event from RadGrid

4 Answers 43 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 29 Jul 2012, 11:46 PM
I have a RadGrid on my page and I'd like to be able to click a GridButtonColumn and have it populate the row from the grid into the Advanced Form (which I've customized greatly).  I've figured out how to get the items out of the grid (below), however I don't know how to populate and show the form.

How would I do this? 

protected void grdOpenOrders_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "schedule")
            {
                GridDataItem item = (GridDataItem)e.Item;               
                //item["material"].Text
                //item["subpool"].Text
                //item["quantity"].Text
                //item["unit"].Text
                //item["shipdate"].Text
                //item["orderDate"].Text               
            }
        }

4 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 30 Jul 2012, 11:23 AM
Hi Steven,

You can use custom attributes to pass and store additional information about an appointment. Then you can populate the fields of the advanced form by creating a new appointment object and setting attributes for the appointment and calling the ShowAdvancedEditForm method:
protected void Button1_Click(object sender, EventArgs e)
 {
     Appointment a = new Appointment();
     a.Subject = "test";
     a.Attributes["material"] = "type a";
     a.Attributes["quantity"] = "3";
     a.Start = DateTime.Now;
     a.End = DateTime.Now.AddDays(1);
 
     RadScheduler1.ShowAdvancedEditForm(a);
 }

Would that work for your case?

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Steven
Top achievements
Rank 1
answered on 30 Jul 2012, 06:13 PM
I used your code and the advanced form isn't showing when I use either ShowAdvancedInsert or ShowAdvancedEdit.  I stepped through everything and it all completes without errors.  I have also verified that there are no JavaScript errors, either.

Ideas?

protected void grdOpenOrders_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "schedule")
            {
                GridDataItem item = (GridDataItem)e.Item;
                Appointment orderFromGrid = new Appointment();
 
                orderFromGrid.Subject = item["material"].Text;
                orderFromGrid.Attributes["ShipDate"] = item["shipdate"].Text;
                orderFromGrid.Attributes["UnitOfMeasure"] = item["unit"].Text;
                orderFromGrid.Start = DateTime.Today;
                orderFromGrid.End = DateTime.Today.AddHours(getStandardBatchTime(item["material"].Text));
 
                //blanks               
                orderFromGrid.Attributes["BatchNumber"] = "";
                orderFromGrid.Attributes["BatchSize"] = "";
                orderFromGrid.Attributes["NonProdTime"] = "false";
 
                //optional               
                orderFromGrid.Attributes["WashPrep"] = "";
                orderFromGrid.Attributes["WorkOff"] = "false";
                orderFromGrid.Attributes["IsLocked"] = "false";
                orderFromGrid.Attributes["RawMaterialDependency"] = "";
                orderFromGrid.Attributes["Comments"] = "";
                orderFromGrid.Attributes["Priority"] = "";
                 
                //schMasterScheduler.ShowAdvancedEditForm(orderFromGrid);
                schMasterScheduler.ShowAdvancedInsertForm(DateTime.Today);
 
            }


0
Steven
Top achievements
Rank 1
answered on 30 Jul 2012, 07:26 PM
The issue is that clicking that image in the grid doesn't cause a postback.  How do I make a GridButtonColumn cause a postback on click?
0
Steven
Top achievements
Rank 1
answered on 30 Jul 2012, 08:03 PM
I found the answer.  I needed to add the scheduler to the ajaxManager

<telerik:AjaxSetting AjaxControlID="grdOpenOrders">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdOpenOrders" LoadingPanelID="ajaxLoadingPanel" />
                <telerik:AjaxUpdatedControl ControlID="schMasterScheduler" LoadingPanelID="ajaxLoadingPanel" />               
            </UpdatedControls>
        </telerik:AjaxSetting>
Tags
Scheduler
Asked by
Steven
Top achievements
Rank 1
Answers by
Peter
Telerik team
Steven
Top achievements
Rank 1
Share this question
or