Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
103 views
Dear reader,

I'm having trouble setting the focus on a radtreeview after doing a serverside action.

The function of this page:
Someone searches a phrase and presses "zoek". Grid gvZoeken gets filled with the results.
Clicking the linkbutton in the grid filles the plnTeksten with the desired text and the desired node in the tree gets selected (abusing the linkbuttons CommandArgument for that.). I also want the page to be scrolled to the treeview thats below the searchgrid.

Things that didnt work:
* RadAjaxManager1.FocusControl(RadTreeView1.ClientID)

* Setting focus on a node in serverside code (RadTreeView1.FindNodeByValue(lb.CommandArgument).Focus())
* Registering a clientscript in the RadScriptManager 
* removing the formdecorator
* All kinds of examples in this forum and the on-line help.

What does work, but is not the desired solution:
Putting a visible textbox on the page and focusing it with RadAjaxManager1.FocusControl(Textbox1.ClientID)

Anyone got idea's?

ASPX:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Dossier.aspx.vb" Inherits="Dossiers_Dossier" %> 
 
<%@ Register Assembly="Telerik.Web.UI, Version=2009.1.527.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Dossier</title> 
    <link href="../css/StyleSheet.css" rel="stylesheet" type="text/css" /> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Sunset" /> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadTreeView1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> 
                        <telerik:AjaxUpdatedControl ControlID="pnlTeksten" /> 
                        <telerik:AjaxUpdatedControl ControlID="pnlDossier" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="gvZoeken">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> 
                        <telerik:AjaxUpdatedControl ControlID="pnlTeksten" /> 
                        <telerik:AjaxUpdatedControl ControlID="pnlDossier" /> 
                     </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <table> 
            <tr> 
                <td> 
                    <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Sunset">  
                        <Items> 
                            <telerik:RadMenuItem Text="Terug" NavigateUrl="Default.aspx" /> 
                        </Items> 
                    </telerik:RadMenu> 
                </td> 
                <td> 
                    <h1> 
                        <asp:Label ID="lblTitel" runat="server"></asp:Label></h1>  
                </td> 
            </tr> 
            <tr> 
                <td colspan='2'>  
                    <table> 
                        <tr> 
                            <td> 
                                Zoek in dossier:  
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbZoekterm" runat="server"></asp:TextBox><asp:Button ID="butZoek" 
                                    runat="server" Text="Zoek" /><br /> 
                                <asp:Label ID="lblEror" runat="server" ForeColor="Red"></asp:Label> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                &nbsp;  
                            </td> 
                            <td> 
                                <telerik:RadGrid ID="gvZoeken" runat="server" AllowPaging="True" AllowSorting="True" 
                                    AutoGenerateColumns="False" GridLines="None" Skin="Sunset" DataSourceID="SqlDataSource2">  
                                    <PagerStyle Mode="NextPrevAndNumeric" NextPageToolTip="Volgende pagina" PagerTextFormat="Verander pagina: {4} &amp;nbsp;Getoonde pagina {0} van {1}, rijen {2} t/m {3} van {5}." 
                                        PrevPageToolTip="Vorige pagina" FirstPageToolTip="Eerste pagina" LastPageToolTip="Laatste pagina" /> 
                                    <MasterTableView DataKeyNames="TekstNr" NoMasterRecordsText="Geen resultaten gevonden." 
                                        DataSourceID="SqlDataSource2" PageSize="10">  
                                        <Columns> 
                                            <telerik:GridTemplateColumn> 
                                                <ItemTemplate> 
                                                    <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Highlight(tbZoekterm.Text,Eval("Titel")) %>' 
                                                        CommandArgument='<%# Eval("TekstNr") %>' OnClick="ZoekItemClick">LinkButton</asp:LinkButton> 
                                                    <br /> 
                                                    <br /> 
                                                    <asp:Literal ID="Literal1" runat="server" Text='<%# Highlight(tbZoekterm.Text,Eval("tekst"))%>'></asp:Literal> 
                                                </ItemTemplate> 
                                            </telerik:GridTemplateColumn> 
                                        </Columns> 
                                    </MasterTableView> 
                                    <ClientSettings EnableRowHoverStyle="true" /> 
                                    <SortingSettings SortedAscToolTip="Oplopend gesoteerd" SortedDescToolTip="Aflopend gesorteerd" 
                                        SortToolTip="Klik hier om te sorteren" /> 
                                </telerik:RadGrid> 
                                <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:DB %>" 
                                    ProviderName="System.Data.SqlClient" SelectCommand="Zoek_in_dossier" SelectCommandType="StoredProcedure" 
                                    runat="server">  
                                    <SelectParameters> 
                                        <asp:QueryStringParameter Name="dossiernr" QueryStringField="dId" Type="Int32" /> 
                                        <asp:FormParameter Name="Zoekterm" FormField="tbZoekterm" Type="String" /> 
                                    </SelectParameters> 
                                </asp:SqlDataSource> 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
            <tr> 
                <td valign="top">  
                    <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Sunset" EnableDragAndDrop="False" 
                        EnableDragAndDropBetweenNodes="False" AllowNodeEditing="False" DataFieldID="Tekstnr" 
                        DataFieldParentID="ParentID" DataSourceID="SqlDataSource1" DataTextField="Titel" 
                        DataValueField="Tekstnr">  
                    </telerik:RadTreeView> 
                    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:DB %>" 
                        ProviderName="System.Data.SqlClient" SelectCommand="GET_DOSSIER_TEKSTEN" SelectCommandType="StoredProcedure" 
                        runat="server">  
                        <SelectParameters> 
                            <asp:QueryStringParameter Name="dossiernr" QueryStringField="dId" Type="Int32" /> 
                        </SelectParameters> 
                    </asp:SqlDataSource> 
                </td> 
                <td valign="top">  
                    <asp:Panel ID="pnlDossier" runat="server">  
                        <table> 
                            <tr> 
                                <td> 
                                    Dossier titel:  
                                </td> 
                                <td> 
                                    <asp:Label ID="lblDossierTitel" runat="server"></asp:Label> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    Instituut:  
                                </td> 
                                <td> 
                                    <asp:Label ID="lblInstituut" runat="server"></asp:Label> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    Versie:  
                                </td> 
                                <td> 
                                    <asp:Label ID="lblVersie" runat="server"></asp:Label> 
                                </td> 
                            </tr> 
                        </table> 
                    </asp:Panel> 
                    <asp:Panel ID="pnlTeksten" runat="server" Visible="false">  
                        <table> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                                <td> 
                                 
                                    <asp:Label ID="lblTitel2" runat="server"></asp:Label> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                                <td> 
                                    Samenvatting:<br /> 
                                    <asp:Label ID="lblSamenvatting" runat="server" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                                <td> 
                                    Verdieping:<br /> 
                                    <asp:Label ID="lblVerdieping" runat="server" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                                <td> 
                                    Detaillering:<br /> 
                                    <asp:Label ID="lblDetaillering" runat="server" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    &nbsp;  
                                </td> 
                            </tr> 
                        </table> 
                    </asp:Panel> 
                </td> 
            </tr> 
        </table> 
    </div> 
    </form> 
</body> 
</html> 
 
VB
Imports Telerik.Web.UI  
Partial Class Dossiers_Dossier  
    Inherits System.Web.UI.Page  
 
    Dim dossierID As Integer 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
        dossierID = Request("did")  
 
    End Sub 
 
    Protected Sub RadTreeView1_NodeDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeDataBound  
        'Expand the parent  
        If e.Node.Value = "0" Then 
            e.Node.Expanded = True 
        End If 
    End Sub 
 
    Protected Sub RadTreeView1_NodeClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick  
        'Selected node changed  
        NodeSelectieveranderd(e.Node)  
    End Sub 
 
    Sub NodeSelectieveranderd(ByVal n As RadTreeNode)  
        If n.Value = "0" Then 'new selectednode is rootnode  
            pnlDossier.Visible = True 
            pnlTeksten.Visible = False 
            lblTitel2.Text = "" 
            lblSamenvatting.Text = "" 
            lblVerdieping.Text = "" 
            lblDetaillering.Text = "" 
        Else 'childnode  
            pnlDossier.Visible = False 
            pnlTeksten.Visible = True 
 
  'fill pnlTeksten  
lblTitel2.Text = "test" 
            n.ExpandParentNodes()  
        End If 
 
    End Sub 
 
    'Find and highlight words that match the searchvalue  
    Public Function Highlight(ByVal Search_Str As String, ByVal InputTxt As String) As String 
        ' Setup the regular expression and add the Or operator.     
        Dim RegExp As New Regex(Search_Str.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase)  
        ' Highlight keywords by calling the delegate each time a keyword is found.     
        Return RegExp.Replace(InputTxt, New MatchEvaluator(AddressOf ReplaceKeyWords))  
        ' Set the RegExp to null.     
    End Function 
 
    'Highlight the keywords  
    Public Function ReplaceKeyWords(ByVal m As Match) As String 
        Return "<span class='Highlight'>" + m.Value + "</span>" 
    End Function 
 
    'Linkbutton in searchgrid is clicked  
    Protected Sub ZoekItemClick(ByVal sender As Object, ByVal e As System.EventArgs)  
        Dim lb As LinkButton = CType(sender, LinkButton)  
        RadTreeView1.FindNodeByValue(lb.CommandArgument).Selected = True 
        NodeSelectieveranderd(RadTreeView1.SelectedNode)  
        RadAjaxManager1.FocusControl(RadTreeView1.ClientID)  
    End Sub 
 
End Class 
it-workz
Top achievements
Rank 1
 asked on 02 Jul 2009
2 answers
112 views
Hi i use telerik rad asp.net controls in my projects(radcombo,radnumerictxtbox e.g.)
I have to clear the all inputs in client-side with javascript

how to do that for radcontrols?
thnx
dank
Top achievements
Rank 1
 answered on 02 Jul 2009
1 answer
114 views
Hi,

 We have a requirement where a TreeViewNode text should have different colors. For ex: if the text is "AAA: Generate Profile" then "AAA" shuld be in red color and "Generate Profile" should be in blue.
 Another requirement is that of having a drill down popup for a Treeview node.

So please let us know if the Telerik's TreeView control can meet these 2 requirements?.

Thanks,
Abhishek
Paul
Telerik team
 answered on 02 Jul 2009
1 answer
179 views

Hi Support Team,

I am working on Rad Editor. In the image upload Area. Afterbrowsing the image I have to add below code inthe click event of upload button.

WebClient oclient = new WebClient();

byte[] responseArray = oclient.UploadFile(PageUrlofRemoteServer,"POST",UploadimagePathAlongwithFileName);

Reason :

 I have to upload thebrowse image to some other location (other domain like http://www.domain.com/images/imagefilename)

for that I wrote the above code which work fine.

But how can integrate this code with Rad Editor UploadButton Click event.

Regards

Ravindra Sahasrabudhe

(rs@mtccrm.com)

Lini
Telerik team
 answered on 02 Jul 2009
1 answer
50 views
I saw inconsistent appearance for IE and FF. In FF, the select upper bound of select button is align with upper bound of input text box. But in IE, the upper bound of select is a bit lower than input text box.

Is there any script or property to set the location of select button to align it with input text box.

Thanks.


Paul
Telerik team
 answered on 02 Jul 2009
1 answer
137 views

Hello All,

           I have purchased a developer version of the Telerik UI controls package and installed the same on a single machine .While installing it creates a key of the version .My question is when I have to install the same on another machines will it do if I just shift the key from the first machine to the others machine.



Reply soon
Thankx
Ritzie
Paul
Telerik team
 answered on 02 Jul 2009
2 answers
178 views

Hi,

I'm trying to use ASP.NET output caching (the @OutputCache directive) to cache pages containing a Telerik RadChart. However, it seems that after some amount of time the chart image URL becomes invalid, and I get an exception when I try to load a cached page. (Actually I get that RadChart popup saying "An error occurred, do you want to see a stack trace?" But if I say yes, all I get is a blank page and no stack trace.)

At first I thought it was because the RadChart is streamed through user session, and I figured that once the session was over for the user that generated the chart, then the chart url became invalid. This seemed reasonable, so I went ahead and changed the chart to UseSession=false and set a TempImagesFolder. With this change, my charts are still served up ok initially, but it failed to fix the problem since the URLs will still become invalid after some amount of time.

My chart image URLs currently look something like this: http://example.com/data/topic/ChartImage.axd?UseSession=false&ImageName=tMecfLN%2fISaQeq5zuhXMkN0UYsBhFjHusj3p4X09SIbwkrgJ7zslmK5GNw2FM%2bOaXQAMOHUlBAO6dlo3%2b0UKOQ%3d%3d&imageFormat=Png

So, do Telerik charts support ASP.NET page output caching? If so, how can I fix the behavior I'm seeing?

Thanks,

Dave

Mark Gregor
Top achievements
Rank 1
 answered on 02 Jul 2009
3 answers
145 views
My previous thread may not be a critical error.  But this one is.

I am using RadControls for ASP.NET AJAX version 2009.1.402.35.  When a RadControl send a postback to server and returned from server, this error occurs.  The page loading handler can go through.  But page loaded handler never been able to reach.  Please help.  Thanks a lot.

Error: uncaught exception: [Exception... "The container of an boundary-point of a range is being set to either a

node of an invalid type or a node with an ancestor of an invalid type."  code: "2" nsresult: "0x805c0002

(NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR)"  location:

"http://localhost:3593/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_ScriptManager1_HiddenField&compres

s=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToke

n%3d31bf3856ad364e35%3aen-US%3a3bbfe379-348b-450d-86a7-bb22e53c1978%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Ve

rsion%3d2009.1.402.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ae2aefbad-6eca-4fec-a07

c-998a5a2d33c0%3a16e4e7cd%3af7645509%3a24ee1bba%3ae330518b%3a1e771326%3ac8618e41%3bESRI.ArcGIS.ADF.Web.UI.WebCon

trols%2c+Version%3d9.3.1.3000%2c+Culture%3dneutral%2c+PublicKeyToken%3d8fc3cc631e44ad86%3aen-US%3a5b74ae6b-e789-

47e1-85a7-8889e4c7ad29%3a6f849c84%3aa8a8211a%3ac5527224%3bTelerik.Web.UI%2c+Version%3d2009.1.402.35%2c+Culture%3

dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ae2aefbad-6eca-4fec-a07c-998a5a2d33c0%3a11a04f7e%3bAjaxCo

ntrolToolkit%2c+Version%3d1.0.10920.32880%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3a81

6bbca1-959d-46fd-928f-6347d6f2c9c3%3adc2d6e36%3ab14bb7d5%3a5acd2e8e%3bESRI.ArcGIS.ADF.Web.UI.WebControls%2c+Vers

ion%3d9.3.1.3000%2c+Culture%3dneutral%2c+PublicKeyToken%3d8fc3cc631e44ad86%3aen-US%3a5b74ae6b-e789-47e1-85a7-888

9e4c7ad29%3adaa3e9c%3adf3baf57%3a7b1c26c6%3a264ee7f6%3a931bab0a%3ae9d1c022%3a211cda53%3bTelerik.Web.UI%2c+Versio

n%3d2009.1.402.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ae2aefbad-6eca-4fec-a07c-99

8a5a2d33c0%3aaa288e2d%3aa7e79140%3ae524c98b Line: 6946"]
Iana Tsolova
Telerik team
 answered on 02 Jul 2009
2 answers
81 views
Hi,

I have several Editors in a Usercontrol through which I want to iterate client-side.

I tried

if ($telerik && Telerik.Web.UI.RadEditor)

but this is giving me ALL editors, I want only the editors in a particular Usercontrol.

Thanks for reply.

Marc
Fit2Page
Top achievements
Rank 3
Bronze
Bronze
Iron
 answered on 02 Jul 2009
2 answers
151 views

When you scale up the text in Firefox with the Zoom function (Ctrl++) when the option "zoom only text" is set, then the TabStrip layout gets disturbed: additional background images get visible below the TabStrip. This can be seen on the Telerik TabStrib demo page as well.

Setting the font to a fixed size (e.g. 12px) in my project's CSS file doesn't help. Does anyone know a workaround? Thanks!

mika-xws
Top achievements
Rank 1
 answered on 02 Jul 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?