Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
180 views
I've got my code below setup and its running, however its always adding the items returned by the web service to the root of the menu. This is a context menu so the options will change for each row in the grid its associated with using data from a database. How do I code it so that the items returned from the web service are added to an existing menu option? For example I want context specific options added under the IIS->Re-start menu as sub-items.

 

 

 

<telerik:RadCodeBlock ID="script1" runat="server">

 

 

 

 

 

 

<script language="javascript" type="text/javascript">

 

 

 

 

 

 

var _serverName,

 

_serverGuid =

"",

 

_rowElement,

_masterTable;

 

var _callCount = 1;

 

 

function GetRowDetails(sender, args) {

 

_masterTable = sender.get_masterTableView();

 

if (_masterTable != null) {

 

 

var row = _masterTable.get_dataItems()[args.get_itemIndexHierarchical()];

 

_rowElement = row.get_element();

 

var cell = _masterTable.getCellByColumnUniqueName(row, "Name");

 

_serverName = cell.innerHTML.toLowerCase().replace(

"<nobr>", "").replace("</nobr>", "");

 

cell = _masterTable.getCellByColumnUniqueName(row,

"ServerGuid");

 

_serverGuid = cell.innerHTML;

}

}

 

function SelectCurrentRow() {

 

_masterTable.selectItem(_rowElement);

}

function RowContextMenu(sender, eventArgs) {

 

}

 

function OnClientItemClicking(sender, eventArgs) {

 

 

}

 

 

function OnClientShowingHandler(sender, eventArgs) {

 

}

 

function onClientItemPopulating(sender, eventArgs) {

 

 

}

 

 

function webServiceLoadingSuccess(sender, eventArgs) {

 

 

var result = eventArgs.get_data();

 

 

var menu = $find("<%= GridMenu.ClientID %>");

 

 

var item = eventArgs.get_context();

 

 

var items = item.get_items();

 

 

if (menu.get_persistLoadOnDemandItems()) {

 

menu.trackChanges();

}

 

 

var childItems = items; //menu.get_items();

 

 

 

 

 

 

for (i = 0; i < result.length; i++) {

 

 

var itemData = result[i];

 

 

var dynamicItem = new Telerik.Web.UI.RadMenuItem();

 

dynamicItem._loadFromDictionary(itemData);

 

if (dynamicItem.get_navigateUrl() == "") {

 

dynamicItem.set_navigateUrl(

"#");

 

}

childItems.add(dynamicItem);

}

 

if (menu.get_persistLoadOnDemandItems()) {

 

menu.commitChanges();

}

}

 

function OnClientShowingHandler(sender) {

 

_callCount = 0;

}

 

function OnClientItemOpening(sender) {

 

 

var menu = sender;

 

 

if (!menu._itemsLoaded) {

 

 

var webServiceSettings = new Telerik.Web.UI.WebServiceSettings({})

 

webServiceSettings.set_path(

"WebServices/GlobalService.asmx");

 

webServiceSettings.set_method(

"GetServerApplications");

 

 

var webServiceLoader = new Telerik.Web.UI.WebServiceLoader(webServiceSettings);

 

webServiceLoader.add_loadingSuccess(webServiceLoadingSuccess);

 

var text = "";

 

 

var value = "";

 

 

if (menu.get_focusedItem() != null) {

 

text = menu.get_focusedItem().get_text();

value = menu.get_focusedItem().get_value();

}

 

var itemData = { Text: text, Value: value };

 

 

var contextData = { ServerGuid: _serverGuid };

 

 

var params = { item: itemData, context: contextData };

 

 

//jQuery("#DebugOutput").html("ServerGuid: " + _serverGuid + " " + _callCount);

 

 

 

 

 

webServiceLoader.loadData(params, menu)

menu._itemsLoaded =

true;

 

}

_callCount++;

}

 

</script>

 

 

 

 

 

 

</telerik:RadCodeBlock>

 

<telerik:RadContextMenu runat="server" ID="GridMenu" ExpandDelay="50" OnItemClick="GridMenu_ItemClick"

 

 

 

OnClientItemClicking="OnClientItemClicking" OnClientShowing="OnClientShowingHandler"

 

 

 

OnClientItemPopulating="onClientItemPopulating" OnClientItemOpening="OnClientItemOpening"

 

 

 

OnLoad="GridMenu_Load">

 

 

 

<WebServiceSettings Method="GetServerApplications" Path="~/WebServices/GlobalService.asmx" />

 

 

 

<Targets>

 

 

 

<telerik:ContextMenuControlTarget ControlID="ServerGrid" />

 

 

 

</Targets>

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Reboot" ExpandMode="ClientSide" />

 

 

 

<telerik:RadMenuItem IsSeparator="true" Value="Sep1" />

 

 

 

<telerik:RadMenuItem Text="IIS">

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Re-start" Value="IIS" ExpandMode="WebService" />

 

 

 

<telerik:RadMenuItem IsSeparator="true" Value="Sep2" />

 

 

 

<telerik:RadMenuItem Text="Start" Value="IIS" ExpandMode="WebService" />

 

 

 

<telerik:RadMenuItem Text="Stop" Value="IIS" ExpandMode="WebService" />

 

 

 

</Items>

 

 

 

</telerik:RadMenuItem>

 

 

 

<telerik:RadMenuItem Text="Services">

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Re-start" Value="Services" ExpandMode="WebService" />

 

 

 

<telerik:RadMenuItem IsSeparator="true" Value="Sep3" />

 

 

 

<telerik:RadMenuItem Text="Start" Value="Services" ExpandMode="WebService" />

 

 

 

<telerik:RadMenuItem Text="Stop" Value="Services" ExpandMode="WebService" />

 

 

 

</Items>

 

 

 

</telerik:RadMenuItem>

 

 

 

</Items>

 

 

 

</telerik:RadContextMenu>

 

 

T. Tsonev
Telerik team
 answered on 22 Sep 2009
2 answers
102 views
Hello,

I am using the export feature of RadGrid to export data to our user community in excel format.
I am setting AutoGenerateColumns to true upon export so that the ouput includes data that is not visible in the grid.
This action will cause the DataKeyNames to be included in the export output.
The DataKeyNames of the MasterTableView are of course necessary when binding data to the grid (binding to the grid is required when exporting).
I would like to hide the DataKeyNames from the export since they reference primary keys for the data and shouldn't be exposed to our users.

Since the grid must be bound before the export, how do I exclude the DataKeyNames from the excel output?

Thanks,
Jon
Jon
Top achievements
Rank 1
 answered on 22 Sep 2009
1 answer
145 views
Hi,

I've been using the following http://www.telerik.com/help/aspnet-ajax/schedule_databindingusingthedatasourceproperty.html help topic as a basis for binding to RadScheduler from the code behind.

I seems to work fine until I try and change to week or timeline view and get the following error:-Invalid attempt to call FieldCount when reader is closed.

Can anyone help or point me in the right direction?

thanks
Dimitar Milushev
Telerik team
 answered on 22 Sep 2009
5 answers
173 views
i have this on the front-end
<telerik:RadGrid AutoGenerateColumns="true" ID="RadGrid1" Visible="false" MasterTableView-EnableNoRecordsTemplate="true" 
                            Width="100%" AllowFilteringByColumn="True" AllowSorting="True" OnSortCommand="RadGrid1_SortCommand" 
                            PageSize="15" ShowStatusBar="true" AllowPaging="True" OnPageIndexChanged="RadGrid1_PageIndexChanged"   
                            runat="server" GridLines="None" OnExcelMLExportStylesCreated="RadGrid1_ExcelMLExportStylesCreated" 
                            OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated">  
                        <PagerStyle Mode="NextPrevAndNumeric" />  
                        <MasterTableView Summary="testing" ></MasterTableView>  
                    </telerik:RadGrid> 
and on the back-end i have
Protected Sub RadGrid1_NeedDataSource(ByVal source As ObjectByVal e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource  
        Select Case tmp_comp_report_ID  
            Case 19  
                GetSectionReport(19, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 0, "")  
            Case 24  
                GetSectionReport(24, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 1, "")  
        End Select 
    End Sub 
 
    Protected Sub RadGrid1_PageIndexChanged(ByVal source As ObjectByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles RadGrid1.PageIndexChanged  
        Select Case tmp_comp_report_ID  
            Case 19  
                GetSectionReport(19, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 0, "")  
            Case 24  
                GetSectionReport(24, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 1, "")  
        End Select 
    End Sub 
 
    Protected Sub RadGrid1_SortCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles RadGrid1.SortCommand  
        Select Case tmp_comp_report_ID  
            Case 19  
                GetSectionReport(19, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 0, "")  
            Case 24  
                GetSectionReport(24, CInt(Request.QueryString.Item("reportid")), CInt(ddl_Stores.SelectedValue.ToString), ddl_Departments.SelectedItem.Text.ToString, 1, "")  
        End Select 
    End Sub 
 
    Protected Sub RadGrid1_ColumnCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated  
        e.Column.HeaderText = Replace(e.Column.HeaderText.ToString, "_"" ")  
        e.Column.AutoPostBackOnFilter = True 
    End Sub 
everything works fine except for paging and sorting. when i click on paging it has javascript error saying object required and sorting also has that. Can you help me please. thank you very much for your time.
Pavlina
Telerik team
 answered on 22 Sep 2009
3 answers
120 views
I am working with a third party application.  We have been using radFormDecorator to make it prettier on our site since it was introduced.  While testing a recent update, we found that they now include a class attribute on their buttons, which means that RFD ignores it.

I would like to make a suggestion for the future that the ability to override this behavior be introduced to make it skin everything.  In conjunction with DecorationZoneId, we could get an extra level of control!

In the meantime, I am trying to use jQuery to remove the class attribute on those buttons so they will be decorated, which is done with a bit of jQuery.  We can see using Firebug that the class attribute gets removed... BUT it doesn't seem to get removed until after the decoration has occurred, because the buttons do not get decorated.

It is attached to ready() on the document by this script:

window.$ = $telerik.$;
$(document).ready(function() {
     $("input.buttonstyle").removeAttr("class");
});

That script is included in the page:

<asp:ScriptManager runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Path="/Site/Master/Js/Controls.js" />
    </Scripts>
</asp:ScriptManager>

I can see that the scripts seem to be loading in the order I need.  The FormDecorator stuff
  1. Webform Postback
  2. MicrosoftAjax.js
  3. MicrosoftAjaxWebForms.js
  4. Core.js
  5. jQuery.js
  6. Controls.js (my script)
  7. FormDecorator

Again, upon inspection, the class does get removed, but just apparently not in time.  Is there a way to ensure that some script runs before decoration occurs??
Joel

Lini
Telerik team
 answered on 22 Sep 2009
3 answers
196 views
Hi,

the ToolsFile contains a region "dialogParameters" - searching help for this give no result :(

My Question: is it possible (I thought with dialogParameters) to set ViewPaths, DeletePaths and UploadPaths of (at least) ImageManager, - document- Flash- and Silverlight Manager?

The reason - if this is possible it would prevent me from messing around in forums code (setting those values) - instead I could simply adapt the toolsFile.

Regards
Manfred
Rumen
Telerik team
 answered on 22 Sep 2009
8 answers
180 views
Hello!

Would it be possible to combine the "Customize the Advanced Template" example with webservices? Currently this example is shown in the "server side API" and I need to use it in combination with a webservice. Could you perhaps provide me with an example?

Thanks in advance!

Bart
Peter
Telerik team
 answered on 22 Sep 2009
3 answers
252 views
Hi

I seem to be having trouble adding onmouseover events to html tags in my rad editor. Exvery time I add say 

&lt;A href="#" onmouseover="GetDescription(13)"&gt;GLOS1&lt;/A&gt; 

into the editor and switch to design view the link appears fine but as soon as the mouse runs over the link I get "jscript runtime error: Object expected. I have no idea why this keeps happening as if I add the anchor anywhere else on the page it works fine.

Does anyone have a reason why this could be.

Regards Mike
Ken Jones
Top achievements
Rank 1
 answered on 22 Sep 2009
1 answer
74 views
Hi,
I have a little problem with the RadtoolTipManager. In my UserControl I use a RadAjaxManagerProxy and a Grid. I added tooltips quite like in the example here. But the tooltips are not showing until I remove the complete RadAjaxManagerProxy. Of course I added the grid and the ToolTipManager to the RadAjaxManagerProxy before, but that did not work.
Any ideas? I would be glad for an answer.

Best regards
Ferdinand
Ferdinand
Top achievements
Rank 1
 answered on 22 Sep 2009
1 answer
84 views
Hi,

Is it possible to bind a chart to a webservice in the same way that you can bind a telerik grid to a webservice?

thanks
Toby
Vladimir Milev
Telerik team
 answered on 22 Sep 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?