Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
141 views
Hello everyone,

I am trying to open a RadWindow from a custom field type and return a value from the user.  The window is supposed to be opened from the custom field (see openSearchDialogButton below) that is implemented as a user control (CustomControl.ascx in ControlTemplates).  The code for this control is encapsulated in an assembly deployed to the GAC.

The user control is defined as follows:

<%@ Control Language="C#" Debug="True" %> 
 
<%@ Assembly Name="Pl.ContractCenter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d55543c9f6e51cd" %> 
<%@ Assembly Name="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> 
<%@ Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%> 
<%@ Register Assembly="Telerik.Web.UI, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<SharePoint:RenderingTemplate ID="PlSearchFieldControl" runat="server"> 
    <Template> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager> 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> 
            <script language="javascript" type="text/javascript"> 
                //<![CDATA[
                function openWin() {
                    var oWnd = radopen("/_layouts/PlSearchCompanyForm.aspx", "RadWindow1");
                }

                function OnClientClose(oWnd, args) {
                    var arg = args.get_argument();
                    if (arg) {
                        var companyNo = arg.companyNo;
                        var o = $get(txtAddValueId); // set in code-behind
                        if (o)
                            o.value = companyNo;
                    }
                }
                //]]> 
            </script> 
        </telerik:RadCodeBlock> 
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnableAJAX="true" > 
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="btnAdd"> 
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="companyNo" /> 
                        <telerik:AjaxUpdatedControl ControlID="companyName" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="deleteButton"> 
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="companyNo" /> 
                        <telerik:AjaxUpdatedControl ControlID="companyName" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager>             
        <telerik:RadAjaxPanel runat="server"> 
            <asp:GridView ID="grdChoices" runat="server" Width="90%" AutoGenerateDeleteButton="True" ShowHeader="false" BorderWidth="0" BorderStyle="None"> 
                <RowStyle CssClass="ms-vb2" /> 
            </asp:GridView> 
        </telerik:RadAjaxPanel> 
        <br /> 
        <a runat="server" ID="openSearchDialogButton" onclick="openWin(); return false;"><img src="/_layouts/images/gosearch.gif" runat="server" id="imgSearch" border="0" alt="search" /></a> 
        <asp:TextBox CssClass="ms-input" ID="txtAddValue" runat="server"/> 
        <asp:Button CssClass="ms-input" ID="btnAdd" runat="server" Text="Add" /><br /> 
        <asp:CustomValidator ID="validGlobal" runat="server" Display="Dynamic"></asp:CustomValidator> 
        <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" runat="server" Skin="Sunset"> 
            <Windows> 
                <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close" OnClientClose="OnClientClose" NavigateUrl="/_layouts/PlSearchCompanyForm.aspx" Width="600" Height="500"></telerik:RadWindow> 
            </Windows> 
        </telerik:RadWindowManager> 
    </Template> 
</SharePoint:RenderingTemplate> 

The page loaded within the RadWindow has the following definition:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Pl.ContractCenter.UI.Pages.SearchCompanyForm, Pl.ContractCenter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d55543c9f6e51cd" %> 
<%@ Assembly Name="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> 
<%@ Register Assembly="Telerik.Web.UI, Version=2009.1.402.35, 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>Search for Companies</title> 
    </head> 
    <body> 
        <form id="form1" runat="server"> 
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager> 
            <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1" > 
                <script language="javascript" 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 returnToParent(companyNo) { 
                        var oArg = new Object(); 
                        oArg.companyNo = companyNo; 
                        var oWnd = GetRadWindow(); 
                         
                        if(oArg.companyNo) { 
                            oWnd.close(oArg); 
                        } 
                    } 
                </script> 
            </telerik:RadCodeBlock> 
            <div> 
                <telerik:RadTextBox runat="server" ID="searchTextBox" />  
                <asp:Button runat="server" ID="searchButton" onclick="searchButton_Click" /> 
                <telerik:RadGrid runat="server" ID="RadGrid1" DataSourceID="odsCompany" AutoGenerateColumns="False" GridLines="None" AllowPaging="True" onitemdatabound="RadGrid1_ItemDataBound">             
                    <MasterTableView DataSourceID="odsCompany" DataKeyNames="CompanyNo"> 
                        <RowIndicatorColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                        </ExpandCollapseColumn> 
                        <Columns> 
                            <telerik:GridBoundColumn DataField="CompanyFullName" HeaderText="Company Name" SortExpression="CompanyByName" UniqueName="CompanyByName"> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridHyperLinkColumn DataTextField="CompanyNo" HeaderText="Number" SortExpression="CompanyNo" UniqueName="CompanyNo"> 
                            </telerik:GridHyperLinkColumn> 
                        </Columns> 
                    </MasterTableView>             
                </telerik:RadGrid> 
                <asp:ObjectDataSource> 
                    <%-- SNIPPED --%> 
                </asp:ObjectDataSource> 
            </div> 
        </form> 
    </body> 
</html> 

Finally, the code-behind for the page:

public class SearchCompanyForm : Page { 
        protected ObjectDataSource odsCompany; 
 
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { 
            try { 
                if (e.Item is GridDataItem) { 
                    var hyperLink = (e.Item as GridDataItem)["CompanyNo"].Controls[0] as HyperLink; 
 
                    if (hyperLink == null) 
                        return; 
 
                    hyperLink.NavigateUrl = "#"; 
                    hyperLink.Attributes.Add("OnClick", String.Format("javascript:returnToParent({0}); return false;", hyperLink.Text.Trim())); 
                } 
            } catch (Exception exception) { 
                Console.WriteLine(exception.Message); 
            } 
        } 
 
        protected void searchButton_Click(object sender, EventArgs e) { 
            odsCompany.Select(); 
        } 
    } 

Clicking the GridHyperLinkColumn returns the selected value as an argument to returnToParent.
The problem I am facing is that the call to radopen fails with the error "radopen is not defined" (Firebug).  While I've got this working in a standard ASP.NET project it just won't work with SharePoint.  Any clues?

Thank you

Steve


Georgi Tunev
Telerik team
 answered on 04 Feb 2010
3 answers
68 views
Hi

I have a grid running with some custom code to add remove columns (I do this by setting the visability of the columns to true/false as necseeary)

My problem is if i set a column to visability false, and then that column had a sort or filter already active on it then that sort or filter persists when the column is invisible

what do i need to do to remove the sort and filter from the column when making it invisible?

Thanks
Tsvetoslav
Telerik team
 answered on 04 Feb 2010
1 answer
173 views
Hello Experts,

I have RadScriptManager on my Master page:

 

<telerik:RadScriptManager ID="rsmJS" runat="server" LoadScriptsBeforeUI="true" EnablePageMethods="true" EnableHistory="true">

 

 

<Scripts>

 

 

<asp:ScriptReference Path="Javascript/jquery-1.3.2.min.js" />

 

 

<asp:ScriptReference Path="Javascript/jquery-ui-1.7.0.min.js" />

 

 

<asp:ScriptReference Path="Javascript/jquery.bgiframe-2.1.1.pack.js" />

 

 

<asp:ScriptReference Path="JavaScript/jquery-1.2.6.js" />

 

 

<asp:ScriptReference Path="JavaScript/blockUI.js" />

 

 

</Scripts>

 

 

</telerik:RadScriptManager>

---------------------------------------------

i want to add History points using the Script manager in my  content page Codebehind?

Also how do i reference the Radscriptmanager into my content page?

Thanks

 

T. Tsonev
Telerik team
 answered on 04 Feb 2010
1 answer
101 views
Hi,

I am trying to change the selected view on my scheduler via a SelectedIndexChanged event from a combo box. I do not want to give the user the ability to select all the views, so i have created a combo that only gives the options of timeline & month.

When the user selects the option that it is not the default, I get the following exception:

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

If I use the combobox to change other properties, such as the selected date etc, it works fine. It only throws the exception when I am trying to change the selected view.

Could you please tell me how I can get that working?

void SchedulerView_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    { 
 
        if (SchedulerView.SelectedValue == "Timeline") 
        { 
            SiteSchedule.SelectedView = SchedulerViewType.TimelineView; 
        } 
        else if (SchedulerView.SelectedValue == "Month") 
        { 
            SiteSchedule.SelectedView = SchedulerViewType.MonthView; 
        } 
       
    } 
The controls are ajaxified using a rad ajax manager




Peter
Telerik team
 answered on 04 Feb 2010
1 answer
991 views
I have a GridHyperLink Column that I need to open the link in a new window.
I am using the following asp.net code
<telerik:GridHyperLinkColumn DataNavigateUrlFields="JobFile" DataTextField="JobTitle" 
                    HeaderText="Job Title" UniqueName="JobFileHyperLink" Target="_blank">  
                </telerik:GridHyperLinkColumn> 

It opens in the current window, rather than opening a new window.

How can this be accomplished?

Thanks
Tsvetoslav
Telerik team
 answered on 04 Feb 2010
4 answers
173 views
I have several projects on version 2009.3.1208.35.

The Upgrade Wizard notified me of the availability of version 2009.3.1314.0, which I attempted to install.

18mb was downloaded, and then nothing.

No error messages, but also no BIN files appear to be updated.

The Project Configuration Wizard shows that the older version is still in effect.
..........

Is there some other step that I need to complete the upgrade?
..............
Environment: Vista Pro 32 bit / VS 2008 / IIS 7
Andrey
Telerik team
 answered on 04 Feb 2010
1 answer
100 views
Hello Telerik,

our company has recently revamped a new product for our customers using most of the Telerik Rad Controls.  We have a lot of instances of the Grid, ToolBars, Charts, Editors and Panels.  We're also using the RadAjaxManagers.  The problem we're facing now is that when a user visits a page, several MB of memory is allocated on the web server (or locally if we're testing on our own dev machines) and this memory is never released.   We're to the point where some pages are loading 10-20 mb into memory, so right now we're limited to 10 users per web server and it will eventually run out of memory. 

We are going through this article http://www.telerik.com/products/aspnet-ajax/resources/top-performance.aspx to optimize as best we can, but something isn't right, is there any reason that the aspnet_wp.exe will keep Telerik resources in memory for ever?

It appears as though the MB's that are loaded into memory are never released.

Anyone else experience this and have any ideas?

This other post in the forums http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/memory-problems-using-telerik-controls.aspx describes exactly the same scenario we're facing.

T. Tsonev
Telerik team
 answered on 04 Feb 2010
5 answers
247 views

Hello,

I am facing one problem. I have used GridTemplate and have dropdown in edit mode as shown below.

 <telerik:GridTemplateColumn UniqueName="StatusColumn" HeaderText="Approved Status">  
                <ItemTemplate> 
                   <asp:Label id="lblStatus" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "status") %>'>  
                       
                   </asp:Label> 
                </ItemTemplate> 
                <EditItemTemplate> 
                   <asp:DropDownList id="ddlApprovalStatus" runat="server" > 
                    <asp:ListItem Text="Pending" Value="False"></asp:ListItem> 
                   <asp:ListItem Text="Approved" Value="True"></asp:ListItem> 
                   </asp:DropDownList> 
                                  </EditItemTemplate> 
                <ItemStyle Width="40px" /> 
            </telerik:GridTemplateColumn> 

I had set AllowAutomaticUpdates="True" of Rad grid and binding grid with SqlDataSource
i had set status field in database as bit. Now if i update the record in grid then it set null in database. I suppose it doesn't pick the dropdown value and is picking the textvalue, and bit datatype in database in not able to store my text, that is why its storing null.

How to pick selected value field of dropdown?
I am using SqpDataSource like this
<asp:SqlDataSource ID="SqlDataSource1" runat="server"   
    ConnectionString="<%$ ConnectionStrings:test %>"   
    DeleteCommand="DELETE FROM [Test] WHERE [id] = @id"   
    InsertCommand="INSERT INTO [Test] ([name], [phone], [email], [company], [status]) VALUES (@name, @phone, @email, @company,@StatusColumn)"   
    SelectCommand="SELECT [id], [name], [phone], [email], [company], [status], [username], [password], [cmsmemberid] FROM [ltsConsultant]"   
    UpdateCommand="UPDATE [Test] SET [name] = @name, [phone] = @phone, [email] = @email, [company] = @company,  [status] = @StatusColumn WHERE [id] = @id">  
    <DeleteParameters> 
        <asp:Parameter Name="id" Type="Int32" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="name" Type="String" /> 
        <asp:Parameter Name="phone" Type="String" /> 
        <asp:Parameter Name="email" Type="String" /> 
        <asp:Parameter Name="company" Type="String" /> 
        <asp:Parameter Name="StatusColumn" Type="String" /> 
        <asp:Parameter Name="id" Type="Int32" /> 
    </UpdateParameters> 
    <InsertParameters> 
        <asp:Parameter Name="name" Type="String" /> 
        <asp:Parameter Name="phone" Type="String" /> 
        <asp:Parameter Name="email" Type="String" /> 
        <asp:Parameter Name="company" Type="String" /> 
        <asp:Parameter Name="StatusColumn" Type="String" /> 
    </InsertParameters> 
</asp:SqlDataSource> 
Tsvetoslav
Telerik team
 answered on 04 Feb 2010
3 answers
69 views
I have 2 RadComboBoxes.  The first is loaded on PageLoad.  The second is Load On Demand which depends on the first combo box.  When the ItemsRequested event of the Load On Demand combo box is fired, I cannot get the SelectedValue of the first combo box.

What is the suggested method for something like this?

Seth
Veselin Vasilev
Telerik team
 answered on 04 Feb 2010
1 answer
205 views
I'm sure this is a simple solution but I don't know the terminology to use for searching. I simply want to specify that a control within an updatepanel should cause a full postback. How is this done?
Shinu
Top achievements
Rank 2
 answered on 04 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?