Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
145 views

Hi, I have a page (SiteScheduler.aspx) with a RadGrid and a RadScheduler on it and I followed the online examples of how to drag and drop rows from the RadGrid to the RadScheduler - and it works perfectly.  I wired up a RadWindow to open from a ContextMenu - and the RadWindow, which is modal and appears over SiteScheduler.aspx, allows the user to change the assigned staff person to the appointment in the scheduler.   Here again, that functionality works great.    My staff person reassignment correction is made.   When the RadWindow closes, it executes   document.location.reload() to refresh SiteScheduler.aspx.  

My problem I ran into yesterday and still today is that if I had dragged a row from the RadGrid to the Scheduler  prior to right clicking and open the RadWindow to reassign the staff person, the RadGrid1_RowDrop event is executed again on the document.location.reload() (or F5 for that matter).   This causes an incorrectly scheduled staff person.  It's like the RowDrop is still 'remembering' the prior drop action and even the same row that was dragged before  to the RadWindow opening.

If I do not drag a row from the grid to the scheduler before right clicking to open the RadWindow to reassign the staff person,  the RadGrid1_RowDrop event is not executed and it works as required.

Here are a couple of things I tried:

1.  Thought it might be cache related so I turned off client side caching by placing this in Page_load

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now);
Response.Cache.SetNoServerCaching();
Response.Cache.SetNoStore();​

2.  Because of the way the page works , I had to set EnableAJAX="False" in the RadAjaxManager.   I would love to be able refresh just the scheduler but don't know how to do this with EnableAJAX="False"  being set.

3.  I tried to simulate the click event of a button that refreshes and rebinds the scheduler however the button does not exist in the RadWindow close event (as the form's controls are not present yet) so it does not work.

Is there something I am missing or do you have any suggestions?  Is there a way to 'Cancel' or dispose of the prior RadGrid RowDrop event once it is complete so it is not executed again?

Here is my RadGrid definition if it helps:

 <telerik:RadGrid runat="server" ID="RadGrid1" Skin="Metro" Style="border: none; outline: 0;"
                AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Height="800px"
                AllowAutomaticDeletes="True" MasterTableView-DataKeyNames="StaffId" OnItemCommand="RadGrid1_ItemCommand"
                OnItemCreated="RadGrid1_ItemCreated" OnRowDrop="RadGrid1_RowDrop" OnRowDropped="RadGrid1_RowDropped" AutoGenerateColumns="False" PageSize="30" RenderMode="Lightweight" Width="100%"
                RetainExpandStateOnRebind="True" ClientSettings-AllowAutoScrollOnDragDrop="False">
                <ClientSettings AllowRowsDragDrop="True">
                    <Selecting AllowRowSelect="True"></Selecting>
                    <ClientEvents OnRowDropping="rowDropping" OnRowDblClick="onRowDoubleClick"></ClientEvents>
                    <Scrolling AllowScroll="True" ScrollHeight="800px" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView DataKeyNames="StaffId" RetainExpandStateOnRebind="True">
                    <RowIndicatorColumn Visible="False">
                    </RowIndicatorColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="StaffFullName" FilterControlAltText="Filter colStaffname column" Groupable="False" HeaderText="Staff Name" ReadOnly="True" Reorderable="False" UniqueName="colStaffname" HeaderTooltip="skdj">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <FilterMenu RenderMode="Lightweight"></FilterMenu>
                <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
            </telerik:RadGrid>​

 

Thanks for any help you can provide.

 Shawn

shawn
Top achievements
Rank 1
 answered on 28 Aug 2015
0 answers
112 views

Hi

Please bear with me I'm quite new to Teleik. My scenario is I have a RadGrid which is built completely in C# code because the columns can vary. Each data bound field is either a link button or a label. For the link button I want to be able to open a child window which contains a RadGrid displaying the drill down data of the selected link button.

This is the code which builds the main RadGrid:

001.private Control DefineGridStructure(DataTable InGrid)
002.    {
003.        RadGrid grid = new RadGrid();
004.        grid.ID = "RadGridDetail";
005.        grid.DataSource = InGrid;
006.        grid.Skin = "Outlook";
007.        grid.Width = Unit.Percentage(100);
008.        grid.AllowPaging = false;
009.        grid.AutoGenerateColumns = false;
010.        grid.MasterTableView.Width = Unit.Percentage(100);
011.        grid.HeaderStyle.Font.Size = 10;
012.        grid.HeaderStyle.Font.Bold = true;
013.        grid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
014. 
015.        try
016.        {
017.            grid.MasterTableView.DataKeyNames = new string[] { InGrid.Columns[1].ColumnName };
018. 
019. 
020.            GridBoundColumn Col1 = new GridBoundColumn();
021.            Col1.DataField = InGrid.Columns[0].ColumnName;
022.            //GridBoundColumn Col2 = new GridBoundColumn();
023.            //Col2.DataField = InGrid.Columns[1].ColumnName;
024. 
025.            if (InGrid.Columns[0].ColumnName == "PDESC")
026.            {
027.                Col1.HeaderText = "Problem Description";
028.                //Col2.HeaderText = "Problem Code";
029.            }
030.            else
031.            {
032.                Col1.HeaderText = "Region";
033.            }
034.            grid.Columns.Add(Col1);
035. 
036.            //Col3 - Query
037.            GridTemplateColumn Col3 = new GridTemplateColumn();
038.            Col3.ItemTemplate = new MyTemplate("Query", "£'s Val", "In Qry");
039.            Col3.HeaderText = "Query";
040.            grid.Columns.Add(Col3);
041. 
042.            //Col4 - 90D
043.            GridTemplateColumn Col4 = new GridTemplateColumn();
044.            Col4.ItemTemplate = new MyTemplate("D90", 4, "lnk");
045.            Col4.HeaderText = "90+ Days";
046.            grid.Columns.Add(Col4);
047. 
048.            //Col5 - Month 3
049.            GridTemplateColumn Col5 = new GridTemplateColumn();
050.            Col5.ItemTemplate = new MyTemplate("M3", 5, "lnk");
051.            Col5.HeaderText = Utils.GetMonth(3) + "-" + Utils.GetYear(3);
052.            grid.Columns.Add(Col5);
053. 
054.            //Col6 - Month 2
055.            GridTemplateColumn Col6 = new GridTemplateColumn();
056.            Col6.ItemTemplate = new MyTemplate("M2", 6, "lnk");
057.            Col6.HeaderText = Utils.GetMonth(2) + "-" + Utils.GetYear(2);
058.            grid.Columns.Add(Col6);
059. 
060.            //Col7 - Month 1
061.            GridTemplateColumn Col7 = new GridTemplateColumn();
062.            Col7.ItemTemplate = new MyTemplate("M1", 7, "lnk");
063.            Col7.HeaderText = Utils.GetMonth(1) + "-" + Utils.GetYear(1);
064.            grid.Columns.Add(Col7);
065. 
066.            //*****Building dynamic number of weeks column******
067.            DataTable NumWeeks = Utils.GetDataTable("SELECT * FROM [dbo].[fn_GetNumWeeks]() ORDER BY intWEEK ASC");
068.            int numOfWeeks = NumWeeks.Rows.Count;
069. 
070.            for (int i = 1; i < (numOfWeeks + 1); i++)
071.            {
072.                int columnNo = 7 + i;
073.                GridTemplateColumn Cols = new GridTemplateColumn();
074.                Cols.ItemTemplate = new MyTemplate("Wk" + i, columnNo, "lnk");
075.                Cols.HeaderText = Utils.GetMonth(0) + "<br/> " + "Week " + i;
076.                grid.Columns.Add(Cols);
077.            }
078.            //*************************************************
079. 
080.            //Col13 - MTD
081.            GridTemplateColumn Col13 = new GridTemplateColumn();
082.            Col13.ItemTemplate = new MyTemplate("MTD", 13, "lnk");
083.            Col13.HeaderText = "MTD";
084.            grid.Columns.Add(Col13);
085. 
086.            //Col14 - YTD
087.            GridTemplateColumn Col14 = new GridTemplateColumn();
088.            Col14.ItemTemplate = new MyTemplate("YTD", 14, "lbl");
089.            Col14.HeaderText = "YTD";
090.            grid.Columns.Add(Col14);
091. 
092.            //Col15 - OO/S
093.            GridTemplateColumn Col15 = new GridTemplateColumn();
094.            Col15.ItemTemplate = new MyTemplate("OOS", 15, "lbl");
095.            Col15.HeaderText = "Overall <br/> Outstanding";
096.            grid.Columns.Add(Col15);
097. 
098.            //Col16 - % OS Vs OV
099.            GridTemplateColumn Col16 = new GridTemplateColumn();
100.            Col16.ItemTemplate = new MyTemplate("Pct", 16, "lbl");
101.            Col16.HeaderText = "% Of Outstanding <br/> Vs Overall";
102.            grid.Columns.Add(Col16);
103. 
104.            ShowResult.Controls.Add(grid);
105.        }
106.        catch
107.        {
108.            //No records found.
109.        }
110.        return grid;
111. 
112.    }

The columns are generated using Templates:

01.Label[] lblVal = new Label[17];
02.        Label[] lblQty = new Label[17];
03. 
04.        LinkButton[] lnkVal = new LinkButton[17];
05.        LinkButton[] lnkQty = new LinkButton[17];
06. 
07.        public MyTemplate(string cName, int typeID, string clinkOrLabel)
08.        {
09.            ID = typeID;
10.            templateType = cName;
11.            colname = cName;
12.            linkOrLabel = clinkOrLabel;
13.            Params = 3;
14.        }

 And finally, this is the InstantiateIn code which creates the grid and prints it to the screen:

01.public void InstantiateIn(Control container)
02.        {
03.            Literal lc = new Literal();
04.            lc.Text = "<hr style='border: 1px;border-style: dotted;'/>";    
05. 
06.            if(templateType == "Query")
07.            {
08.                Label lblValQ = new Label();
09.                lblValQ.ID = colname + "Val";
10.                Label lblQtyQ = new Label();
11.                lblQtyQ.ID = colname + "Qty";
12.                lblValQ.Font.Size = 9;
13.                lblQtyQ.Font.Size = 9;
14.                 
15.                if (Params == 3)
16.                {
17.                    lblValQ.Text = ValCnt;
18.                    lblQtyQ.Text = QtyCnt;
19.                }
20.                container.Controls.Add(lblValQ);
21.                container.Controls.Add(lc);
22.                container.Controls.Add(lblQtyQ);
23.            }
24.            else
25.            {
26.                //decided whether the field should be a link button or a label
27.                if (linkOrLabel == "lnk")
28.                {
29.                    lnkVal[ID] = new LinkButton();
30.                    lnkVal[ID].DataBinding += lnkVal_DataBinding;
31.                    lnkVal[ID].Attributes.Add("OpenWindow", "openChildWindow(4,31,99);");
32.                    lnkQty[ID] = new LinkButton();
33.                    lnkQty[ID].DataBinding += lnkQty_DataBinding;
34.                    lnkQty[ID].Attributes.Add("OpenWindow", "openChildWindow(4, 31,99);");
35.                         
36.                    container.Controls.Add(lnkVal[ID]);
37.                    container.Controls.Add(lc);
38.                    container.Controls.Add(lnkQty[ID]);
39.                }
40.                else
41.                {
42.                    lblVal[ID] = new Label();
43.                    lblVal[ID].DataBinding += lblVal_DataBinding;
44.                    lblQty[ID] = new Label();
45.                    lblQty[ID].DataBinding += lblQty_DataBinding;                 
46. 
47.                    container.Controls.Add(lblVal[ID]);
48.                    container.Controls.Add(lc);
49.                    container.Controls.Add(lblQty[ID]);
50.                }
51.            }
52.        }

I am attempting to add Attributes to all the linkbuttons which will send to the javascript displayed below to get the data for the new window.   

1.<script type="text/javascript" language="javascript">
2.        function openChildWindow(Period, SalesMn, intWeek, ReasCode) {
3.            window.open('RadGridExportWebForm.aspx?Period=' + Period + '&SalesMn=' + escape(SalesMn) + '&intWeek=' + intWeek + '&ReasCode=' + ReasCode, 'childWindow', 'width=800,height=600,scrollbars=1,menubar=0,status=0,toolbar=0,resizable=1,titlebar=0', false);
4.        };
5.  </script>

However what is actually happening is the current page is simply reloading, it's not creating or opening a new window as I want it to.

I hope this makes sense

Any help would be greatly appreciated.

Many thanks!

Katie
Top achievements
Rank 1
 asked on 28 Aug 2015
2 answers
83 views

is possible to re size RadDockZone to either 320 x 270px or 640 x 270px?

Then, allow the user to add new RadDockZones dynamically when an "add zone" button is clicked?

 

 

Ianko
Telerik team
 answered on 28 Aug 2015
1 answer
299 views

Hi all,

Is there a way to export the HtmlChart as an image (stream) on the server-side? I'm trying to generate graphics to add to PDF's completely server-side. All I have seen is client-side exportImage.

Regards,

Evan

Danail Vasilev
Telerik team
 answered on 28 Aug 2015
1 answer
93 views

in the sample code at response.end call I get a script error in my .ascx

Line: 885
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

 

private void WriteCalendar(string data)
{
    HttpResponse response = Page.Response;
 
    response.Clear();
    response.Buffer = true;
 
    response.ContentType = "text/calendar";
    response.ContentEncoding = Encoding.UTF8;
    response.Charset = "utf-8";
 
    response.AddHeader("Content-Disposition", "attachment;filename=\"RadSchedulerExport.ics\"");
 
    response.Write(data);
    response.End();
}

Aneliya Petkova
Telerik team
 answered on 28 Aug 2015
13 answers
245 views

Hi

The following is my code.

 

<telerik:RadWizard runat="server" ID="RadWizard1" OnWizardStepCreated="RadWizard1_WizardStepCreated">
    <WizardSteps>
         <telerik:RadWizardStep ID="rwsStart" Title="شروع" StepType="Start">
         </telerik:RadWizardStep>
         <telerik:RadWizardStep ID="rwsEnd" Title="پایان" StepType="Finish">
         </telerik:RadWizardStep>
   </WizardSteps>
   <Localization Next="بعدی" Cancel="انصراف" Finish="پایان" Previous="قبلی" />
</telerik:RadWizard>
  
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick" Enabled="True">
</asp:Timer>

 When the timer post back page. There is an error to say:

Multiple controls with the same ID 'rwsEnd' were found. FindControl requires that controls have unique IDs.

Plamen
Telerik team
 answered on 28 Aug 2015
8 answers
118 views

Hi,

Having recently installed the new Q2 2015 SP1 version of the controls I have noticed that some of my grids behave differently.  Before if columns didn't have a specific width they'd expand to fill the width of the grid.  Now they don't.

Any suggestion on what change could be causing this behavior?

Regards

Jon

Jon
Top achievements
Rank 1
 answered on 28 Aug 2015
1 answer
80 views
Is there a RadEditor version for NET 1.1  that works on IE8 and IE11?
Danail Vasilev
Telerik team
 answered on 28 Aug 2015
1 answer
118 views

Hello,

 I am working on a concept much like in your demo here (http://demos.telerik.com/aspnet-ajax/listview/examples/itemdragdrop/defaultcs.aspx), however, the difference is that instead of Link Buttons for the genre, I have RadListView instead so it looks something like this.

 

<RadListView ID='tracksListView'></RadListView> /* List of all tracks */
  
<Repeater ID='genreRepeater'>    /* List of all Genre */
   <ItemTemplate>
      <RadListView ID='genreListView' OnItemDrop="RadListView_ItemDrop">
          <ItemTemplate> /*List of tracks per Genre */ </ItemTemplate>
      </RadListView>
   </ItemTemplate>
</Repeater>

 I've created the server side event for the Item Drop of RadListView however, when I'm ​dragging an item to another RadListView (either tracksListView or genreListView), the e.DestinationHtml on the ItemDrop event shows the ID of the origin.

 

For example,

 

The repeater generated 3 genre (pop, love, classic) and when I drag a track from pop to love, the e.DestinationHtml returns the ID of the radlistview of pop.

 

Please help, thank you.

      

Konstantin Dikov
Telerik team
 answered on 27 Aug 2015
0 answers
100 views

before all hi and as i wrote on title VSB don't save my project simply. to be more specify it tells:

"missing data

default  DLL does not exist in:

<program> \ Data \ AveStyle.msstyles"

 

but if the name <program> is just the path where is situated the program into "programms (x86)" folder; then that file exist

 

thank you in advantage

TERA
Top achievements
Rank 1
 asked on 27 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?