Hello,telerik:
As a beginner.I hava some questions:
1.In telerik grid,How to merge the same cell value among lots of rows?
2.Anthor question about RadWindow.
If a RadWindow is opend, how to fefresh the opener window by clicking the buttion in the opend window?
thanks.
As a beginner.I hava some questions:
1.In telerik grid,How to merge the same cell value among lots of rows?
2.Anthor question about RadWindow.
If a RadWindow is opend, how to fefresh the opener window by clicking the buttion in the opend window?
thanks.
4 Answers, 1 is accepted
0
Accepted
Shinu
Top achievements
Rank 2
answered on 01 Mar 2010, 07:07 AM
Hello,
1.
You can merge the cells having same values using the following code:
C#:
In this example, if a cell value is the same as a value in the next (lower) row, then its RowSpan is increased and the lower cell is made invisible.
2.
By obtaining a reference to a RadWindow component, you can call any function that is defined in the parent window. Use the BrowserWindow property to reference the parent window .
javascript on content window:
And the function named 'CalledFn' should be defined on parent page, with the code to reload the page.
javscript on parent page:
All the best,
Shinu.
1.
You can merge the cells having same values using the following code:
C#:
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| for (int rowIndex = RadGrid1.Items.Count - 2; rowIndex >= 0; rowIndex--) |
| { |
| GridDataItem row = RadGrid1.Items[rowIndex]; |
| GridDataItem previousRow = RadGrid1.Items[rowIndex + 1]; |
| for (int i = 0; i < row.Cells.Count; i++) |
| { |
| if (row.Cells[i].Text == previousRow.Cells[i].Text) |
| { |
| row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1; |
| previousRow.Cells[i].Visible = false; |
| } |
| } |
| } |
| } |
In this example, if a cell value is the same as a value in the next (lower) row, then its RowSpan is increased and the lower cell is made invisible.
2.
By obtaining a reference to a RadWindow component, you can call any function that is defined in the parent window. Use the BrowserWindow property to reference the parent window .
javascript on content window:
| function GetRadWindow() |
| { |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function CallFnOnParent() |
| { |
| GetRadWindow().BrowserWindow.CalledFn(); |
| } |
And the function named 'CalledFn' should be defined on parent page, with the code to reload the page.
javscript on parent page:
| function CallFn() |
| { |
| window.location.reload(true); |
| } |
All the best,
Shinu.
0
songsp
Top achievements
Rank 1
answered on 02 Mar 2010, 03:01 AM
Shinu ,thanks.
en,About the question 2, iImet another questions.
1. In the server-side code,How do I open the radwindow?
2. For the window opened ,I have a "<asp:button runat='server'>,How do I close the current window when I clicking the button at server side after I executed persisting operation(such as update a row in the table)?
en,About the question 2, iImet another questions.
1. In the server-side code,How do I open the radwindow?
2. For the window opened ,I have a "<asp:button runat='server'>,How do I close the current window when I clicking the button at server side after I executed persisting operation(such as update a row in the table)?
0
Shinu
Top achievements
Rank 2
answered on 02 Mar 2010, 06:00 AM
Hello,
1.
The following code will help you in opening the window from code behind.
C#:
Setting Server-Side Properties for window is described in the documentation. Have look at this: Setting Server-Side Properties
2.
And for closing the window, add client method with code for closing the window. Call the method from server side as shown below.
C#:
client side code:
Hope this helps. :)
Best wishes,
Shinu.
1.
The following code will help you in opening the window from code behind.
C#:
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| RadWindow newwindow = new RadWindow(); |
| newwindow.ID = "RadWindow2"; |
| newwindow.NavigateUrl = "http://www.google.com"; // Set the url |
| newwindow.VisibleTitlebar = true; |
| newwindow.Behaviors = WindowBehaviors.Close; // Set the Behaviors |
| newwindow.VisibleOnPageLoad = true; // Set VisibleOnPageLoad property to True |
| RadWindowManager1.Windows.Add(newwindow); // Add the window to WindowManager collection |
| } |
2.
And for closing the window, add client method with code for closing the window. Call the method from server side as shown below.
C#:
| ScriptManager.RegisterStartupScript(this, this.GetType(), "closeWindow", "CloseWindow();", true); |
client side code:
| <script type="text/javascript"> |
| function GetRadWindow() { |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function CloseWindow() { |
| GetRadWindow().close(); |
| } |
| </script> |
Best wishes,
Shinu.
0
songsp
Top achievements
Rank 1
answered on 17 Mar 2010, 04:55 AM
thanks you,Shinu.
very nice of you to reply.
Did any message from Telerik about AJAX Toolkit providing the tools of Tree Telergrid on future?
best wishes.
very nice of you to reply.
Did any message from Telerik about AJAX Toolkit providing the tools of Tree Telergrid on future?
best wishes.