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

 

 

 

How can I create a a rotator with "FormCode" mode while being able to start that rotator automatically when the page loads? I need a complete sample code for the call.

I've used the following JavaScript/JQuery code for FormCode management:

 

<script type 
="text/javascript">  
    
//<![CDATA[  
    
function 
    
startRotator(clickedButton, rotator, direction)  
    
    
if  
(!rotator.autoIntervalID)  
    
 
    
 refreshButtonsState(clickedButton, rotator); 
    
 rotator.autoIntervalID = window.setInterval( 
    
function  
() 
rotator.showNext(direction); 
}, rotator.get_frameDuration()); 
function  
stopRotator(clickedButton, rotator) 
if  
(rotator.autoIntervalID) 
refreshButtonsState(clickedButton, rotator) 
window.clearInterval(rotator.autoIntervalID); 
rotator.autoIntervalID =  
null 
function  
showNextItem(clickedButton, rotator, direction) 
rotator.showNext(direction); 
refreshButtonsState(clickedButton, rotator); 
    
    
// Refreshes the Stop and Start buttons  
    
function  
refreshButtonsState(clickedButton, rotator) 
    
    
var  
jQueryObject = $telerik.$; 
    
var className = jQueryObject(clickedButton).attr("class" 
    
); 
    
switch  
(className) 
     
case "start"  
    
    
// Start button is clicked  
jQueryObject(clickedButton).removeClass(); 
    
jQueryObject(clickedButton).addClass( 
    
"startSelected"  
);  
    
// Find the stop button. stopButton is a jQuery object  
var stopButton = findSiblingButtonByClassName(clickedButton, "stopSelected"  
);  
    
if  
(stopButton)  
    
// Changes the image of the stop button  
stopButton.removeClass(); 
    
stopButton.addClass( 
    
"stop"  
); 
     
}  
    
}  
    
break  
     
case "stop"  
    
// Stop button is clicked  
jQueryObject(clickedButton).removeClass(); 
    
jQueryObject(clickedButton).addClass( 
    
"stopSelected"  
);  
    
// Find the start button. startButton is a jQuery object  
var startButton = findSiblingButtonByClassName(clickedButton, "startSelected"  
);  
    
if  
(startButton) 
// Changes the image of the start button  
startButton.removeClass(); 
    
startButton.addClass( 
    
"start"  
);  
}  
}  
break  
    
// Finds a button by its className. Returns a jQuery object  
function  
findSiblingButtonByClassName(buttonInstance, className) 
var  
jQuery = $telerik.$; 
var ulElement = jQuery(buttonInstance).parent().parent();  
    
// get the UL element  
var allLiElements = jQuery("li", ulElement);  
    
// jQuery selector to find all LI elements  
for (var  
i = 0; i < allLiElements.length; i++) 
var  
currentLi = allLiElements[i]; 
var currentAnchor = jQuery("A:first", currentLi);  
    
// Find the Anchor tag    
    
if  
(currentAnchor.hasClass(className)) 
return  
currentAnchor;  
    
//]]> 
    
</script 
>

And the following code for the calls:

 

 

 

 

<
  
a href="#" onclick="stopRotator(this, $find('<%= MyRotator.ClientID %> 
')); return false;" 
   
class="stopSelected" title="Stop"><span>Stop</span></a> <a href="#" onclick="startRotator(this, $find('<%= MyRotator.ClientID %> 
'), Telerik.Web.UI.RotatorScrollDirection.Left); return false;" 
   
class="start" title="Start"><span>Start</span></a> <a href="#" onclick="showNextItem(this, $find('<%= MyRotator.ClientID %> 
'), Telerik.Web.UI.RotatorScrollDirection.Left); return false;" 
  
class="left" title="Left"><span>Up</span></a> <a href="#" onclick="showNextItem(this, $find('<%= MyRotator.ClientID %> 
'), Telerik.Web.UI.RotatorScrollDirection.Right); return false;" 
  
class="right" title="Right"><span>Down</span></a 
>

 

 

 

 

 

However, I cannot start the rotator on the page load. Tried to use this code in the in the MyRotator_DataBoud event, but did not work either:  

 

protected void rrMyRotator_DataBound(object sender, EventArgs 
 e) 
Page.RegisterClientScriptBlock( 
"MyScript", "<SCRIPT Language='JavaScript'> startRotator(this, $find('<%= MyRotator.ClientID %>'), Telerik.Web.UI.RotatorScrollDirection.Left);</SCRIPT>"
); 
}

 

 

 

Please show me the code that I need to write to start the rotator right after loading the page, and the location where I should place that code. Thank you.

Qusay
Top achievements
Rank 1
 answered on 11 Jun 2011
2 answers
401 views
Hello,

I'm opening a RadWindow that allows a user to enter a record into a database.  On the OnClientClose() event, I'm trying to refresh a RadListBox that is in a RadAjaxPanel in the parent page.  This seems like it should be straight forward but I'm not having any luck.  I'm new to web programming so I'm sure I just don't understand something.  I am making it to the code behind once the window is closed so I know the DataBind() is executing.  However, while I see the loading panel displayed the new item does not show up in the RadListBox.  Any ideas as to what I'm doing wrong?  Thanks!

 

ASP

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lstProducts" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7" />
    <qsf:InformationBox runat="server" Title="Please note you can't obsolete a product if it is still in use by another team.<br>You can add or edit products by right-clicking on the 'Products' box."
        Width="97%">
    </qsf:InformationBox>
  
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px"
           OnAjaxRequest="RadAjaxPanel1_AjaxRequest">
           <telerik:RadListBox ID="lstProducts" runat="server" AllowTransfer="True" AutoPostBackOnTransfer="True"
                   DataSortField="PRODUCT" DataSourceID="SqlDataSource1" DataTextField="PRODUCT"
                   DataValueField="PRODUCT_ID" EnableDragAndDrop="True" Height="250px" OnTransferred="lstProducts_Transferred"
                   SelectionMode="Multiple" Skin="Windows7" OnClientContextMenu="showContextMenu"
                   Style="top: 0px; left: 0px; width: 215px" TransferToID="lstObsolete" AllowAutomaticUpdates="True">
           </telerik:RadListBox>
     </telerik:RadAjaxPanel>


Javascript

function OnClientClose() 
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); 
}

 

 

C#

 

 

 

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) 
{
    if (e.Argument == "Rebind"
    {
        lstProducts.DataBind();  //i do make it here
    }
}

 

 

 

 

 

 

 

 

 

 

 

Casey
Top achievements
Rank 1
 answered on 10 Jun 2011
2 answers
96 views
i am using the example of related combo box

http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

The only problem, I am having is my combo box is inside the RadpanelBar. I could not figure out what to write for this

function pageLoad()
{
    // initialize the global variables
    // in this event all client objects
    // are already created and initialized
    countriesCombo = $find("<%= RadComboBox2.ClientID %>");    
    citiesCombo = $find("<%= RadComboBox3.ClientID %>");
}


when I do this
$find("<%= RadComboBox2.ClientID %>");    

It could not find the control because this combo box is inside the rad panel bar. can anyone please tell me the script to get the client ID of the control inside the radpanel bar,

any help will be apprecaited.
Anjali
Top achievements
Rank 1
 answered on 10 Jun 2011
4 answers
148 views
My company just purchased the Developer license for the ASP.NET version 2011.1.519.35 control set. After complete removal of the trial version and re-installation of the purchased product I am now receiving the error in the attached controlerror.png file. I removed all instances of Telerik from the web.config during the removal of the Trial version. I then copied the new telerik.web.ui.dll and placed it into the solution libary folder and references that dll in the solution. I then ran the 'configure project' selection from Telerik menu to bring my web.config into compliance for this version. No existing controls in the project will render either all controls are showing different errors ( see attached Page1Errors.png) any help would be appreciated.
Tim
Top achievements
Rank 2
 answered on 10 Jun 2011
3 answers
227 views
I am trying to use the NestedViewTemplate with scrollable table.
I would simple like to add a nested template into a table like this one:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/scrolling/defaultcs.aspx

However, I have no luck doing so...

There might be another way to achieve what i'm looking for, which is to have a grid where each row is actually contracted out of 2 rows so the second row of the record (similar to nestedview) will present some additional info (like "comments")

Something like this:

Row1, Cell 1:<name> | Row1, Cell 2:<email> | Row1, Cell 3:<phone> | Row1, Cell 4:<>
Row2, Cell1 (colspan=4) comments are typed here                                                    
Row3, Cell 1:<name> | Row3, Cell 2:<email> | Row3, Cell 3:<phone> | Row3, Cell 4:<>
Row4, Cell1 (colspan=4) comments are typed here                                                    


Is that possible?
Pavlina
Telerik team
 answered on 10 Jun 2011
4 answers
205 views
Hi,
I am using NestedViewTemplate in my application. but i want hide expand Image when record not found cells only.

given code i am using now. please give me a tips for this one.

<telerik:RadGrid ID="gvAddPlans" runat="server" AutoGenerateColumns="False" DataSourceID="sdsDispayPlans" OnPreRender="gvAddPlans_PreRender"
                        Width="740px" GridLines="Both">
                        <MasterTableView  HierarchyDefaultExpanded="false" AutoGenerateColumns="false"
                            CommandItemDisplay="Top" DataKeyNames="sp_pln_id">
                            <NoRecordsTemplate>
                                <div align="center">
                                    There are no records to display</div>
                            </NoRecordsTemplate>                           
                                </div>
                            <Columns>
                            ----------------------------------------------
                            ------------------------------------------------
                            </Columns>
                            <NestedViewTemplate>
                                <telerik:RadGrid ID="rgFlex" runat="server" AutoGenerateColumns="False" OnItemDataBound="rgFlex_OnItemDataBound" DataSourceID="sdsFlexBenefit"
                                    Width="700px" GridLines="Both">
                                    <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top">
                                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                                      
                                        <Columns>
                                         ----------------------------------------------
                                             ------------------------------------------------
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid>
                            </NestedViewTemplate>
                        </MasterTableView>
                    </telerik:RadGrid>


Thanks,
Dhamu
Smiely
Top achievements
Rank 1
 answered on 10 Jun 2011
1 answer
97 views

On VB.CODE side I wrote:
RadGrid1.MasterTableView.DataKeyNames = {"CustomerID"}
RadGrid1.ClientEvents.OnRowSelected = "RowSelectd"

 

 

I want to read DataKeyNames property inside OnRowSelected event:

function
RadGrid1_RowSelected(gridName, rowId) {

 

 

var grid = gridName;  

var oBand = grid.get_masterTableView();

 

 

var row = oBand.get_dataItems()[rowId.get_itemIndexHierarchical()];

 

 

MyLabel.value = oBand.getCellByColumnUniqueName(row, "CustomerID"

).innerHTML;

 

 

}

In this manner I'll can replace the "CustomerID" static string with the dynamic property obtained from DataKeyNames array[0]

Thanks

 

 

 

 

 

 

 

 

 

 

Datatrek
Top achievements
Rank 1
 answered on 10 Jun 2011
7 answers
83 views
Hi:

I am looking for documentation on Clientside api for RadTreeList which provides more detail information than can be found on the available documentation. I am looking for Object models,Methods, Details aboutn Event Arguments etc.

Does such document exist or the installed documentation is all that is available.

Thanks
Veli
Telerik team
 answered on 10 Jun 2011
4 answers
117 views
I am using RadControls for ASP.NET AJAX Q1 2011.  I have an application where the Telerik controls have an unspecified skin (that is, there is no SkinID entry in the XML definitions).  I added the following to my web.config:
<add key="Telerik.Skin" value="Windows7" />

When I run the application, the CSS attributes (font, color, transperancy, etc.) are applied, but none of the background images that would come from the sprites are rendered.

I also tested
<add key="Telerik.RadGrid.Skin" value="Windows7" />
<add key="Telerik.Radmenu.Skin" value="Windows7" />
but no joy.

If I go to a control and specify
SkinID="Windows7"
then all is well - the background images are present.  I have reviewed (some of) the documentation, and it seems the web.config entry is a valid method to set the SkinID.  What am I missing?

Further - if a control has a SkinID attribute set, then the web.config entry overrides it (and works).  Please don't tell me I have to set a SkinID on all controls to use the web.config method.

Scott

 

 

 

 

 







Scott Buchanan
Top achievements
Rank 1
 answered on 10 Jun 2011
2 answers
36 views
Hi,

 if I ll bind 500 rows to rad-grid with set property allowpaging is true ,after that I pass the 2nd pageDataKeyName value as a parameter.  but I can not retrieve the 2nd page DataKeyName item index.

what can i do for this problem?

this is my  code

Private Sub GRD_NewsList_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GRD_NewsList.PreRender
        If Not Page.IsPostBack Then
            Dim val As String = GetNumeric(Request("NewsId"))
            If val = 0 Then
                GRD_NewsList.MasterTableView.IsItemInserted = True
            Else
                For Each Items As GridDataItem In GRD_NewsList.MasterTableView.Items
  
                    If GetNumeric(Items.GetDataKeyValue("NewsId")) = val Then
                        Items.Edit = True
                        Exit For
                    End If
                Next
            End If
            GRD_NewsList.Rebind()
        End If
    End Sub

nanthakumar thangavel
Top achievements
Rank 1
 answered on 10 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?