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

display radgrid in new radwindow on same page and enable drag and drop from that radgrid to another radgrid on same page

13 Answers 402 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neerav
Top achievements
Rank 1
Neerav asked on 23 Nov 2010, 09:39 AM
I am developing prototype using telerik rad controls. One of my requirement is to display a radgrid dynamically inside a radwindow  which comes up as a new pop window, on hyperlink click event. There is an additional radgrid on the page. I would then want to drag a row from the dynamically created radgrid(inside radwindow) into existing radgrid on the same page.
I know that radwindow can be used as container for containing controls from same page but I want to the radwindow as new pop up on same page and then I can refer Id's of both radgrid controls while drag and drop.

Kindly reply
Neerav Patel

13 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 26 Nov 2010, 09:32 AM
Hi Neerav,

Because of the nature of the RadWindow which is being rendered as an IFRAME, that loads the content from your destination URL, you cannot drag HTML DOM elements from it into the parent page. You might consider changing your approach to use the ability of RadWindow to be used as dialog and handle the page's grid updating logic manually.

Sincerely yours,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Neerav
Top achievements
Rank 1
answered on 26 Nov 2010, 04:40 PM
Thanks for your reply.

We have been able to open the radwindow in new window pop up on same (default.aspx) page. This "radgrid1" does not have predefined columns and the columns are defined from code behind using datatable.columns.add() method.
Now we have an empty "radgrid1" on default.aspx page which is empty and not bound to any database.
We have a filled "radgrid2" in radwindow with "template column" which will delete a particular row and add that row to an empty "radgrid1" on default.aspx page as shown in figure 5 of attached document.
We now want a column in "radgrid1" which can delete row from "radgrid1".
The columns in "radgrid1" as mentioned earlier were defined during runtime while moving row data from "radgrid2" to "radgrid1".
But now we also want a column in "radgrid1" which can delete a row from "radgrid1". I have added delete column to "radgrid1" using smarttag from aspx page. When the rows get from "radgrid2" to "radgrid1" the delete link do gets displayed but it does not deletes the row in clicking.
Can you let us know a workaroung to it.
In the attached document  "selected courses"  will our "radgrid1" and "search results"  will be our "radgrid2".

-----------------------------------------------------

Also there is a template column in "radgrid2" in radwindow, which moves row from "radgrid2" to "radgrid1". It works but not on first click.
When the radwindow get open, we have to click on "template column" twice to delete row from "radgrid2". Again on second click the row gets deleted but when I publixh this site on other machine it shows error "server:error" and does not work.

It seems that forum does not allow to attach files.
However kindly provide us a work around after going through the problem

Thanks





We now want to to achive the functionality as mentioned in attached screen shot document.
0
Neerav
Top achievements
Rank 1
answered on 29 Nov 2010, 04:27 PM
Hello every one,
I have two radgrids radgrid1 and radgrid2(opened in new radwindow on link click event). Radgrid1 is empty. Radgrid2 is filled with data. I have created a template column in radgrid2 which on click,  will move the row from radgrid2 to radgrid1.After moving, the row should also get deleted from radgrid2. I have bounded columns of radgrid2 in .aspx page with sqlserver database.
My code behind is able to move data from radgrid2 to radgrid1 but I am not getting the row to be deleted from radgrid2. This data should get deleted temprorarily since whenever the radgrid2 gets opens it should displays all rows(including rows moved from radgrid2 to radgrid1).
I know that telerik:gridclientdelete column deletes rows from client side. But the problem is I want to achieve both moving an deleting from same template column.
Can anyone let me know as to how to create a template column which move ane delete row from client side only.
Also, is it required that for implenting such scenario the database should be binded from code behind, if yes then let me know how to create template columns using datatable. SInce using datatable we can create tables and add rows to it.

Kinldy reply.

Thanks and regards
0
Neerav
Top achievements
Rank 1
answered on 30 Nov 2010, 03:32 PM
Hi every one,

I have been able to resolve my previous problem where only one row was getting hidden at one time quite a bit.
I have used paging on my grid. The grid shows 5 records on single page. Now when I click, suppose on row 1 of page1, the row1 of page1 gets hidden along with row 1 on all pages. May be this is because all pages maintain row index from 0.
Following is my "OnItemCommand_radgrid_command" method where I maintain all row indexes in session "link" variable.
Then I have implemented "prerender" method where I traverse through "link" variable and one by one hide the rows. But rows from all pages gets hidden.
 My "OnItemCommand_radgrid_command" mehtod

protected

 

 

void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

 

if (e.CommandName == "MoveToSelected" || e.CommandName == "Delete")

 

{

 

 

// RadGrid1_ItemDeleted(source, e);

 

 

 

GridDataItem dataItem = (GridDataItem)e.Item;

 

 

 

int index = dataItem.ItemIndex;

 

 

 

int[] arrtemp = (int[])Session["hide"];

 

 

 

int iii = (int)Session["var"];

 

 

 

List<int> lint2 = (List<int>)Session["link"];

 

lint2.Add(index);

Session[

 

"link"] = lint2;

 

arrtemp[(

 

int)Session["var"]] = index;

 

iii++;

Session[

 

"var"] = iii;

 

Session[

 

"hide"] = arrtemp;
}


And my preprender method

 

 

 

protected void prerender(object sender, System.EventArgs e)

 

{

 

 

int[] arr1 = (int[])Session["hide"];

 

 

 

int val1 = (int)Session["var"];

 

 

 

List<int> lint1 = (List<int>)Session["link"];

 

 

 

 

if ((bool)Session["state"] == true)

 

{

Session[

 

"state"] = false;

 

}

 

 

else

 

 

 

 

 

{

 

 

foreach (GridDataItem itemm in RadGrid2.MasterTableView.Items)

 

{

 

 

foreach(int oo in lint1)

 

{

 

 

if (itemm.ItemIndex == oo)

 

itemm.Visible =

 

false;

 

 

}

 

 

 

 

}

}

}

This is quite problamatic for me.
Kindly let me know as to how to for furthur.

0
Tsvetina
Telerik team
answered on 01 Dec 2010, 10:24 AM
Hi Neerav,

What do you mean by saying that items from other pages are hidden, too? In PreRender you have access only to the first page of items in RadGrid, since it loads only them from the datasource? Have you tried calling Rebind() for your grid after you finish the row hiding procedure?

Regards,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Neerav
Top achievements
Rank 1
answered on 01 Dec 2010, 01:19 PM
Hi Tsvetina,

Thank for you reply.
For the time being the problem I am able to get my problem working.
I was using rowindex in session variable,  instead of which i used key value of rows and I got my problem working.
--------------------------------------------------------------------------------------------------------------------------------------------------
Now I have a panel "panel1" on my .aspx page. This panel is used to contain two radtreeview rtv1 and rtv2, where rtv1 is declared in .aspx page and rtv2 is declared in "page_load event";
There are two asp:radio buttons "rb1" and "rb2". By default "rb1" will get selected and rtv1 will display in panel1. 
Now  when I click "rb2", rtv1 should get clear from panel1 and rtv2 should get displayed in panel1 i.e. one radtreeview controls should get displayed in panel1 at a time.

I have used session variables to store rtv1, rtv2 , panel1. Now on click of rb2, when I try to remove rtv1 from panel1, it gets removed but after that when I try to add rtv2 to panel1 I get following error  
"Script controls may not be registered after PreRender."

I have telerik script manager declared on .aspx page.

Kindly let me know where I am getting wrong.

Thanks and Regards



 


0
Neerav
Top achievements
Rank 1
answered on 02 Dec 2010, 01:52 PM

Dear Telerik staff,

Got the previous problem working.
--------------------------------------------------------------
There is an issue with radgrid updating

I have a empty "RadGrid1" and hyper links "A","ALL"...  on default.aspx page.
 On click of "ALL" I have opened a new window pop up using  "RadWindow" with radopen = ("default.aspx", radwindowID) method. This will pop up the window on same(default.aspx) page. Now this radwindow is defined on default.aspx page with a another radgrid "radgrid2" in it using content template tags of radwindow. The radgrid2 also has a template column with command = "move to selected" which on click will move the corresponding row from radgrid2 to radgrid1 and hide that row in radgrid2. This process can fill up radgrid1(which was empty). The radgrid2 has "onitemcommand  = "radgrid1_itemcommand"" property set to handle click event from template column (command name = "move to selected"), this property  has logic for hiding row in radgrid2 and moving row to radgrid1.

Now I have been able to open the window on same page with radgrid2 in it with template column "+" in it.
The page get loads and all GUI gets displayed properly along with radgrid1 and links. WHen I click "ALL" the radwindow gets pop up with data filled radgrid2 with template column "+" in it.
 The problem is, when I click "+" i.e. template column for first time the "radgrid1_itemcommand" method does not get fired. But from second click onwards the command gets fired and all workds well (i.e. rows get move to radgrid1 from radgrid2).
On click of template column the radgrid1_itemcommand does not gets fired for first time and because of that, the row does not get move from radgrid2 to radgrid1  only for first time. BUt ll works on and after second click on template column.

PFA the images of my current scenario where "Radgrid_image1" is image where I click on "+" for first time and nothing happens and "radgrid_image2" is image where the row moves to radgrid1 and get hidden in radgrid2.

 Ihave used following

 

<telerik:RadAjaxManager runat="server" ID="radAjax" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2"/>
<telerik:AjaxUpdatedControl ControlID="RadGridfirst" />

</UpdatedControls>
</telerik:AjaxSetting>
</telerik:RadAjaxManager>

Important thing that when I comment the above ajax setting code, all start to work well even for firts time i.e. rows gets shifted from from first click on template column. But this process closes the radwindow every time the template column getsclicked, so I have to click "ALL" again for opning the radwindow which is not at all my requirement.

Kindly reply

Thanks and Regards

 

0
Neerav
Top achievements
Rank 1
answered on 04 Dec 2010, 01:38 PM

Hello Telerik Staff,
The previous problem is working for the time being.
Three is a issue with Radtreeview context menu.

I have a scenario where I have to open a data filled grid in a new radwindow, on click event of radtreeview node.
PFA the images of my scenario.
IN figure 1 i have a treeview "User Hierarchy". I have used radtreeview for for this.
Now this treeview has a user "n,k" which on click opens up menu list with two options "n,k" and "View Assignments" as
given in figure 2.I have used "context menu" for this purpose.

Now my requirement is, on click of "View Assignments" a new datafilled grid will get open in a new window as shown in
Figure 3.
This new grid will display data according to selection of the tree node in figure 2.
 
Kindly let me know as to how to go further for implementing my requirement.
I have seen that Radwindow does not any control from "OnContextMenuItemCLick" event.
Also let me know as to how to create the radgrid i.e. from .aspx page or from code behind since the "select *" query in radgrid will be conditional.

Kindly Reply

0
Tsvetina
Telerik team
answered on 06 Dec 2010, 11:10 AM
Hello Neerav,

You can try using the client OnClientItemClicked event of the RadContextMenu to open the window, there should be no problem in doing so, as you also would have access to the client state of the treeview node.

As for the RadGrid - it depends on your requirements. If it is possible for you to use auto-generated columns, the easiest approach would be to create a declarative RadGrid in mark-up, handle its data-binding and leave it to create its columns alone. But if you want to manually dynaically change its structure, you would need to create it in code-behind, as demonstrated in this help article:

Changing the grid structure dynamically on postback

All the best,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Neerav
Top achievements
Rank 1
answered on 08 Dec 2010, 03:25 PM

Hello everyone,
Thanks for your reply. For the time being I have different implementation and it is working for now. Thanks any way
--------------------------------------------------------------------------------------------------------------------------------------- 
In the mean time while developing a prototype I have encountered the following problem

Attached are the screenshots of what is actually required.
We have  a "Course/Group Courses" tab page as given in figure 1 of attached screen shot.

Another tab "Hierarchy/Attributes" tab as given in figure 2 of attached screen shot.

In figure 2 in "User Hierarchy" tree view I have checked "n,k" which is part of "Test" group, and  in figure 1 I have selected "Test1" from "Course Groups" tree view and there are two courses in "Selected Courses" grid.

Now in figure 1 you can see there is a "Make Assignment" button which on click displays figure 3 as a new window with a filled radgrid.
The grid in figure 3 has "Assign To" and "Assign Content" and various other columns.
The "Assign To" column is  hyperlink with data same as node selected in figure 2 i.e. "Test". I think this is a template column.
As well as "Assign Content" has values from "Course Groups" and "Selected Courses".
I want to know as to how to create this grid as shown in figure 3.

Since I cannot fire select query because all items are coming dynamically, can you let me know how to create the radgrid as shown in figure 3.

For implementing the current requirement in our prototype, I have used following link
http://www.telerik.com/help/aspnet-ajax/grdbindingtonullableobjects.html, by which I think I would be able to retrieve data from treeview and grid and create datasource as arraylist for figure3 radgrid. Am I going correct?
My figure 3 radgrid is declared in aspx page. Since I have to create the figure 3 grid on "Make Assignment" button click event, when I click the button the grid displays with no records in new radwindow.

Following is my button lcik event code.

ArrayList algrid = (ArrayList)Session["arr"]; // for data from treeview from figure 1

ArrayList algrid1 = (ArrayList)Session["arr1"];// for data from treeview from figure 2

ArrayList list = new ArrayList();
foreach (string s in algrid)
{
    foreach (string s1 in algrid1)
    {

    list.Add(new TestListItem1(s, s1))
    }

}

Session["ds"] = sourcelist2;
makegrid.Rebind();
-----------------------------------------
and following is my onneeddatasource code

ArrayList sourcelist = (ArrayList)Session["ds"];
this.makegrid.DataSource = sourcelist;
----------------------------------------------

but the grid displays no data.

Kindly let me know as to how to go for this.

Thanks and regards

 

0
Tsvetoslav
Telerik team
answered on 11 Dec 2010, 09:28 AM
Hello Neerav,

Put a break-point in the NeedDataSource event and check two things:

1. Is the NeedDataSource event being called at all.

2. Is there anything contained within the (ArrayList)Session["ds"];  session variable.

Regards,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Neerav
Top achievements
Rank 1
answered on 21 Dec 2010, 01:50 PM
Hello Telerik Staff,

We have been able to find workaround for the while for our previous reply. Thanks again for your reply.

We have an another issue here related to RadTreeView.
PFA the screen shot of our current scenario.

In "Figure1" we have a tree view "User Hierarchy". This treeview has binded with nodes using serversidecallback load on demand.
 
Now in "Figure2" there is a "search" option on top of the page. On clicking the magnifying icon the "Search Results" grid gets opened up. Now in the grid you can see there is a "<-" arrow sign which on click will search the corresponding node in "User Hierarchy" and display the node by highlighting it in "User Hierarchy" as displayed in "Figure3" and "Figure4".
 
"Figure4" is the actual image("Figure3" is for unserstanding purpose about the hierarchy), as it highlights the node to top of the tree("User Hierarchy").
 
We are trying to implement the same in our demo application.
Can you suggest us as to how to search such node in "User Hierarchy" and highlighting it in the same at the node to top of the tree("User Hierarchy").
 
Since our tree is binded by serversidecallback load on demand, using RadTreeView.GetAllNodes() will not work if I search any child node.
Kindly provide us proper solution to this and let us know if we are not going correct.
 
Awaiting your reply.
 
Thanks and Regards
0
Nikolay Tsenkov
Telerik team
answered on 23 Dec 2010, 04:00 PM
Hello Neerav,

I have posted an answer in this thread: http://www.telerik.com/community/forums/aspnet-ajax/treeview/adding-context-menus-dynamically-for-childnode-while-using-load-on-demand-webservice-method-for-populating-the-tree-node.aspx


Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Neerav
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Neerav
Top achievements
Rank 1
Tsvetoslav
Telerik team
Nikolay Tsenkov
Telerik team
Share this question
or