Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
288 views

I'm trying to get a javascript block to work within a RadDock:

 

 

 

 

 

<telerik:RadDock ID="RadDock5" runat="server" Width="300px">

 

<ContentTemplate>

 

 

    <%= DateTime.Now %>

 

 

 

    <br />

 

    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

        <script type='text/javascript' src='http://www.worldtimeserver.com/clocks/embed.js'></script>

 

 

        <script type="text/javascript">

 

 

        objGB = new Object; objGB.wtsclock = 'wtsclock001.swf';

 

 

        objGB.color =

'FFCC33'; objGB.wtsid = 'JP';

 

 

        objGB.width = 100; objGB.height = 100;

        objGB.wmode =

'transparent'; showClock(objGB);

 

 

        alert(

"after");
</script>

 

 

</telerik:RadScriptBlock>

 

</ContentTemplate>

 

</telerik:RadDock>

 

 

 

 


It always works on a full page refresh. On a partial page refresh, time is updated and the alert shows, but the javascript object disappears.

What's up? I've been banging my head for weeks with this and other possible solutions.

(the RadDock is part of a standard RadDockLayout set up, by the way) 

thanks

 

 

 

 

 

 

 

 

 

Rich Erwin
Top achievements
Rank 1
 answered on 23 Sep 2009
9 answers
353 views
I try to use FormTemplate in Grid:
 
<telerik:radgrid ID="RadGrid1" runat="server" GridLines="None" ShowGroupPanel="True" 
            Width="99%" AllowSorting="True" AllowMultiRowSelection="false" allowpaging="True" 
            pagesize="6" skin="Outlook" OnNeedDataSource="RadGrid1_NeedDataSource"   
            HorizontalAlign="NotSet" onitemcommand="ChangeAccount" 
              
        >                       
            <MasterTableView AutoGenerateColumns="false" DataKeyNames="Username"   
                CommandItemDisplay="Bottom">  
                <PagerStyle Mode="NextPrevAndNumeric" /> 
                <Columns> 
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" /> 
                    <telerik:gridboundcolumn headertext="Last Name" datafield="lastname" /> 
                    <telerik:gridboundcolumn headertext="First Name" datafield="firstname" /> 
                    <telerik:gridboundcolumn headertext="Phone #" datafield="Telephone"/>  
                    <telerik:gridboundcolumn headertext="Email" datafield="email" /> 
                    <telerik:GridButtonColumn headertext="Lock" CommandName="Lock" ButtonType="ImageButton"   
...etc.                  
</Columns> 
 
                <EditFormSettings EditFormType="Template">  
                        <FormTemplate> 
                            <table cellspacing="7" cellpadding="1" width="100%">  
                                <tr><td colspan="2"><b>Username:&nbsp;<span id="spanUname" runat="server"><%# Eval("username") %></span></b> 
                                    <asp:TextBox Width="200px" ID="tbUname" runat="server"/></td></tr>  
                                <tr><td><table class="update"><tr> 
...etc 
...etc.

Form works perfectly.

When I try to get values on update as shown in the example http://www.telerik.com/help/aspnet-ajax/grdupdatingvaluesusercontrolformtemplate.html:
 

 

 

 

 

 

switch (e.CommandName)  
            {  
                 case RadGrid.InitInsertCommandName:  
                GridEditableItem editedItem = e.Item as GridEditableItem;  
                string s = (editedItem.FindControl("tbUname") as TextBox).Text;  
...etc. 

It gives me NullReferenceException, because editedItem is null. When I try to debug, there are absolutely no Controls for e.Item.
I am confused how I can get values from my Textboxes in FormTemplate.
Elena

 

 

 

 

 

 

 

 

 

Elena Lavrinenko
Top achievements
Rank 1
 answered on 22 Sep 2009
0 answers
192 views
Hello!

We just upgraded from what I believe was 2009.1.422.20 to the newest; 2009.2 826.20
Each panelbar we use only have one item with one item with content. The content is fetched with a postback if the panelbar was currently closed. We use an RadAjaxPanel around the RadPanelBar which displays a loading panel, when the user clicks the panelbar. Once the user clicked the panelbar it opened with a height of minimum 40pixels and the resized itself to the full height it needed. This means the loadingpanel was displayed over both the "bar" itself and the content window. 

This worked perfectly in the latest version we used, but when we upgraded to the newest version, the loading panel is only displayed inside the "bar", and the content window displays nothing until the content is ready.

We have a created a custom style for the panelbar which was created for the Q1 version.
The problem is mostly IE related, it works sufficiently in FF and Chrome.

This shows the Q1 working version, which "ajaxifies" the whole Panelbar with content
http://img8.imageshack.us/i/correctp.png/

This shows the newest version 2009.2 826, which only displays the loadingpanel inside the "bar"
http://img8.imageshack.us/i/wrongrh.png/

I know you will probably tell me to create a ticket, but it will be some work for us to create a project with everything working. So I was hoping you had some tips based on my description. If not, I will try to provide one..

If anything is unclear, do not hesitate to ask me to clarify.

Thank you!

Ps. happy Independence day!
stiz0r
Top achievements
Rank 1
 asked on 22 Sep 2009
8 answers
174 views
I'm sure it's something stupid but I load a rad scheduler with appointments and they are all set visible to false. I then load a rad tree view with child nodes that have the same value as the radscheduler appointment's ids. However, when you check a child node I get the error in my JS debugger saying scheduler.get_appointments().findByID(value) is null

               //assume this is the correct ID for the rad scheduler
                var value = eventArgs.get_node().get_value();

                //the instance of the scheduler
                scheduler = $find('<%=RadScheduler1.ClientID %>');

                var appDivID = "#" + scheduler.get_appointments().findByID(value).get_element().id;
                    appDivID.parent().show();  

What am I doing wrong here? Thanks,

Web Services
Top achievements
Rank 2
 answered on 22 Sep 2009
2 answers
109 views
I am using the following method as per the documentation to style a GRid Edit Template PopUp window:

<style type="text/css">
.GridEditForm_Office2007  .GridHeader_Office2007
{

 

background-color: #FFD96F;

 

 

font-size: large;

 

 

font-style: italic;

 

 

font-weight: bold;

 

 

font-variant: normal;

 

 

text-transform: lowercase;

 

 

vertical-align: top;

 

} 
</style>

I have put this in the head section of the document but nothing is being style to this. 

Anyone?
Robert
Top achievements
Rank 1
 answered on 22 Sep 2009
1 answer
194 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
112 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
148 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
180 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 Object, ByVal 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 Object, ByVal 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 Object, ByVal 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 Object, ByVal 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
124 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?