Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
376 views
I've created a project that saves dockstate to a database and dynamically adds docks to the page (based on the myPortal with db example found in these forums).

My project contains one page where a user is displayed a number of default docks and others they have added from a second page.

To reduce the load on the database, instead of saving the dockState to the database every time SaveDockLayout is fired I was planning on retaining the dockState in session and only saving to the database when a dock is actually moved or removed from the database. Part of this I believe can be achieved using the server side event DockPositionChanged. The problem is I cannot get this event to fire.

When creating the dock i've tried the following:
dock.Attributes.Add("OnDockPositionChanged", "RadDock_DockPositionChanged") 
dock.OnClientDockPositionChanged = "RadDock_DockPositionChanged" 


The second obviously doesn't work as it is looking for client code.

Code for the event handler (that doesn't get fired)
Protected Sub RadDock_DockPositionChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.DockPositionChangedEventArgs) 
    Dim dock As RadDock 
    dock = DirectCast(sender, RadDock) 
 
    If dock.DockZoneID <> e.DockZoneID Then 
... 

How do you wire up the dynamically created dock to fire the server event?

Thanks.

Slav
Telerik team
 answered on 18 May 2012
7 answers
294 views

Hi,

I try to generate an OrgChart dynamically, for do that, I need to add actions to the orgChart item (by RadButton).

In my first POC, I try the programm below.

<%@ Control language="C#" Inherits="DotNetNuke.Modules.Quanteam.ContractModule.View" AutoEventWireup="false"  Codebehind="View.ascx.cs" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
 
<asp:MultiView ID="multiView" runat="server">
    <asp:View ID="ViewContractDetail" runat="server">
        <telerik:RadOrgChart runat="server" ID="radOrgChart">
            <Nodes>
                <telerik:OrgChartNode>
                    <ItemTemplate>
                        <div style="background-color: Red; height: 80px; width: 180px;">
                            <telerik:RadButton ID="TestBtnOrgChart" Text="click : 0" runat="server"
                                OnClick="onClick_Handler"
                                ValidationGroup="ParamValidationGroup"
                                ButtonType="LinkButton" BorderStyle="None">
                                <Icon PrimaryIconUrl="~/images/Add.gif" PrimaryIconLeft="5px" />
                            </telerik:RadButton>
                        </div>
                    </ItemTemplate>
                    <GroupItems>
                        <telerik:OrgChartGroupItem Text="Click for Test" />
                    </GroupItems>
                </telerik:OrgChartNode>
        </telerik:RadOrgChart>
    </asp:View>
</asp:MultiView>

 

private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                System.Web.UI.WebControls.View view = FindControl("ViewContractDetail") as System.Web.UI.WebControls.View;
                multiView.SetActiveView(view);
 
                //----------------------------------------------------
                // RadOrgChart
                //----------------------------------------------------
 
                var nodeContract = new OrgChartNode();
                radOrgChart.Nodes.Add(nodeContract);
 
                OrgChartGroupItem topContract = new OrgChartGroupItem() { Template = new MyTemplate("btnOrgChart1") };
                nodeContract.GroupItems.Add(topContract);
 
                var node = new OrgChartNode();
                topContract.Node.Nodes.Add(node);
 
                OrgChartGroupItem missionNode = new OrgChartGroupItem() { Template = new MyTemplate("btnOrgChart2", onClick_Handler) };
                node.GroupItems.Add(missionNode);
 
                //----------------------------------------------------
                // RadButton
                //----------------------------------------------------
 
                RadButton radBtn = new RadButton();
                radBtn.ID = "btn_1";
                radBtn.Text = string.Format("click : {0}", 0);
                radBtn.Click += onClick_Handler;
                view.Controls.Add(radBtn);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 
        class MyTemplate : ITemplate
        {
            private string _id;
            private System.EventHandler _onClick;
 
            public MyTemplate(string id)
            {
                _id = id;
                _onClick = onClick_Handler;
            }
 
            public MyTemplate(string id, System.EventHandler onClick)
            {
                _id = id;
                _onClick = onClick;
            }
 
            public void InstantiateIn(Control container)
            {
                RadButton radBtn = new RadButton();
                radBtn.ID = _id;
                radBtn.Text = string.Format("click {1} : {0}", 0, _id);
                radBtn.Click += _onClick;
                container.Controls.Add(radBtn);
            }
 
            protected void onClick_Handler(object sender, System.EventArgs e)
            {
                RadButton radBtn = sender as RadButton;
                radBtn.Text = string.Format("click {1} : {0}", Convert.ToInt32(radBtn.Text.Split(':')[1]) + 1, _id);
            }
        }
 
        protected void onClick_Handler(object sender, System.EventArgs e)
        {
            RadButton radBtn = sender as RadButton;
            string[] items = radBtn.Text.Split(':');
 
            radBtn.Text = string.Format("{0} : {1}", items[0], Convert.ToInt32(items[1].Trim()) + 1);
        }

 

When I try this program, the button created into the OrgChart by API call the Page_Load handler, but not the associated click handler.
Even if the handler came from the view or from the custom ITemplate class.

The two buttons of control :
- generated with the ASX and inside of the OrgChart
- generated with the API and outside of OrgChart
works normally.

Why my two Button generated with API into the OrgChar seems to don't call the Click event.

For information, I begin on ASP.Net since few week.

Thanks for your help.

 

Peter Filipov
Telerik team
 answered on 18 May 2012
3 answers
127 views
Is it possible to make Tab strip functionality works like Rad Menu which means when I hover on Tab strip I would like to show the Tab items in a drop down how can I achieve this. Also when I select an Item from drop down I would like to set the selected Item in selected state
Kate
Telerik team
 answered on 18 May 2012
1 answer
238 views
Hi ,
I am using Rad Control in SharePoint site masterpage.
in Office2007 skin i want to change the hover color from Orange to white...etc.,
Rad menus comes dynamically, so i don't know how to customize this.

Thanks & Regards
MD Liakath Ali
Shinu
Top achievements
Rank 2
 answered on 18 May 2012
1 answer
127 views
Hi

I am having two treeviews on  a same page.
I want to know that whether there is some in built functionality exists in treeview so that if I drag and drop any node from treeview1 to another trreview2.

Or there is some another control exists in your library to achieve this functionality(I have to mapped one node to the another node in database.)

Please let me know.
Plamen
Telerik team
 answered on 18 May 2012
6 answers
309 views
I have a usercontrol that has a radasync upload. When I set the OnClientFileUploaded event the control is hidden?

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions="png" Width="100%"
                      MaxFileSize="524288" OnFileUploaded="RadAsyncUpload1_FileUploaded" OnClientFileUploaded="fileUploaded"
                      />

If I remove the OnClientFileUploaded tag the control shows with no problem?

P
plusHR
Top achievements
Rank 1
 answered on 18 May 2012
2 answers
172 views
hi guys,

I am trying to bind a list of a custom class to the following RadGridView:

<rad:RadGrid Skin="Office2007" runat="server"
                          
                                       
                               
                                          OnItemDataBound="gridAdd_ItemDataBound"
                         AllowAutomaticDeletes="True"
                         OnItemCommand="RadGrid1_ItemCommand"
                        
                         AllowAutomaticInserts="True"
                         OnInsertCommand="gridAdd_InsertCommand"
                       NoMasterRecordsText="No Files selected for this PO"
                       OnDeleteCommand="gridAdd_ItemDeleted"
                        AutoGenerateColumns="false"  id="gridAdd"
                            AllowPaging="true" PageSize="5" onneeddatasource="gridAdd_NeedDataSource">
                       <MasterTableView   NoMasterRecordsText="No Files selected for this PO"  EditMode="InPlace" AllowAutomaticUpdates="false"   AllowAutomaticInserts="true" CommandItemDisplay="Bottom"   DataKeyNames="ID,FileID, GVMXID"  >
                            <Columns>
                                      
                            <rad:GridEditCommandColumn  ButtonType="LinkButton" UniqueName="EditCommandColumn2">
                                <HeaderStyle Width="20px" />
                                 
                            </rad:GridEditCommandColumn>   
                                 
                              
 
                                <rad:GridTemplateColumn HeaderText="File" >
                                <ItemTemplate>
           
                                    <rad:RadComboBox Visible="false"    CheckBoxes="true"   OnDataBinding="comboFiles_DataBind" DataSourceID="odsFiles"     Height="200" Skin="Vista" ID="comboFiles" Width="200"   DataTextField="OriginalName" DataValueField="ID"    runat="server">
                                   
                                    </rad:RadComboBox>
                                    <asp:Label ID="lblFileName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FileName") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle  Wrap="true" Width="100"  HorizontalAlign="Center" />
                                 <HeaderStyle ForeColor="#4e6ea4" HorizontalAlign="Center" Font-Bold="true" />
                               </rad:GridTemplateColumn>
                               
                               
                              <rad:GridTemplateColumn HeaderText="TM" >
                                <ItemTemplate>
           
                                    <rad:RadComboBox Visible="false" AppendDataBoundItems="true"   Height="200" Skin="Vista" ID="comboTMs" DataSourceID="odsTMs"  DataTextField="TMName" DataValueField="ID" runat="server">
                                    
                                    </rad:RadComboBox>
                                    <asp:Label ID="lblTMName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.TMName") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle  Wrap="true" Width="100"  HorizontalAlign="left" />
                                 <HeaderStyle ForeColor="#4e6ea4" HorizontalAlign="Center" Font-Bold="true" />
                               </rad:GridTemplateColumn>
 
                               <rad:GridTemplateColumn HeaderText="Tag Settings" >
                                <ItemTemplate>
          <table>
          <tr><td style="border:0px; min-width:150px;">
             <asp:CheckBox Visible="false" onclick="toggle(this)"  runat="server" Checked="true" ID="chkDefault" Text="Use Default Tag Settings" />
          </td></tr>
           
          <tr><td style="border:0px;">
           <asp:FileUpload Visible="false"  runat="server" ClientIDMode="Static" ID="fileUpload" />
          </td></tr>
          </table>
                                   
                                 
                                    <asp:Label ID="lblTagSettings" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.TagSettings") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle  Wrap="true" Width="100"  HorizontalAlign="Center" />
                                 <HeaderStyle ForeColor="#4e6ea4" HorizontalAlign="Center" Font-Bold="true" />
                               </rad:GridTemplateColumn>
 
                                 
 
                                <rad:GridButtonColumn ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to delete this file from PO?" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteDiscount">
                                <HeaderStyle Width="20px" />
                          
                            </rad:GridButtonColumn>
                            </Columns>
                            <CommandItemSettings ShowRefreshButton="false"  AddNewRecordText="Add New Files" />
                        </MasterTableView>
                         
                    </rad:RadGrid>

Code behind, NeedDataSource Event:

protected void gridAdd_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
     
    gridAdd.DataSource = (List<POFilesInMemory>)Session["POFiles"];
 
  
}

The Grid is showing empty. I checked the List<POFilesInMemory> and it has items:

Here is the class :
public class POFilesInMemory
{
    public int FileID { get; set; }
    public string FileName { get; set; }
    public int TMID { get; set; }
    public string TMName { get; set; }
 
    public string TagSettingsName { get; set; }
}


Any ideas guys ?


Eyup
Telerik team
 answered on 18 May 2012
5 answers
294 views
Hi
I have been through these forums and found lots of similar examples but none that quite fix my problem.
I have a rad window with a content template that pops up on click of a button.
The user must complete certain things that are checked on the server within the rad window unless an error message is shown, otherwise the details added are saved and the window needs to close.

My problem is my rad window doesn't close!

This is my radwindow 
<telerik:RadWindowManager ID="Radwindowmanager1" runat="server">
    <Windows>
        <telerik:RadWindow runat="server" ID="winDetail" Width="400px" Height="400px"
            ReloadOnShow="true" ShowContentDuringLoad="false" Modal="True" Behaviors="None"
            VisibleTitlebar="true" VisibleStatusbar="false">
            <ContentTemplate>
             
                    <h3>
                        Injury Details
                    </h3>
                    <asp:Label runat="server" ID="lblError"></asp:Label>
                    <div class="modalForm">
                        <ol>
                            <li>
                                <label class="noFloatLabel">
                                    Injury
                                </label>
                                <telerik:RadComboBox ID="ddlName" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlInjuryName_OnSelectedIndexChanged" />
                                <telerik:RadTextBox runat="server" ID="txtNewName">
                                </telerik:RadTextBox>
                            </li>
                            <li>
                                <label class="noFloatLabel">
                                    Specific Detail
                                </label>
                                <telerik:RadComboBox ID="ddSpecific" runat="server" />
                                <telerik:RadTextBox runat="server" ID="txtNewSpecific">
                                </telerik:RadTextBox>
                            </li>
                        </ol>
                    </div>
                    <br />
                    <asp:Button runat="server" ID="btnAddDetail" Text="Add" OnClick="btnAddDetail_Click" />
            <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="btnCancel_Click" />
         <asp:HiddenField runat="server" ID="hdnId" />
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

I am using an ajax manager to try and control the autopopulation of my dropdowns and btnAddDetail with the error message.
<telerik:RadAjaxManager runat="server" ID="aj1">
    <AjaxSettings>
        
        <telerik:AjaxSetting AjaxControlID="ddlName">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ddlSpecific" />
            </UpdatedControls>
        </telerik:AjaxSetting>
         <telerik:AjaxSetting AjaxControlID="btnAddDetail">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="lblError" />
                 
            </UpdatedControls>
        </telerik:AjaxSetting>
         
    </AjaxSettings>
</telerik:RadAjaxManager>

When I click the btnAddDetail 

I run this function
protected void btnAddDetail_Click(object sender, EventArgs e)
        {
 
            if ((ddlName.SelectedValue != string.Empty || txtNewName.Text != string.Empty)
                && (ddlSpecific.SelectedValue != string.Empty || txtNewSpecific.Text != string.Empty))
            {
//do processing if processing fails show error if not close window
 
string script = "function f(){Close(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";         
    ScriptManager.RegisterStartupScript(
this, this.GetType(), "close", script, true);

            }
            else
            {
                lblError.Text = "You must select a name and description";
            }
        }


This is my javascript to close the window:
function GetRadWindow() {
          var oWindow = null;
          if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
          else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
          return oWindow;
      }
 
      function Close() {
          GetRadWindow().close();
      }


Can anyone help with my my window won't close? I know its something to do with how I've used the ajax but I can't work out what!

Bex
Bex
Top achievements
Rank 1
 answered on 18 May 2012
3 answers
198 views
I need to know how to get to the selected value of the filter menu. For example if the user selects "Contains" from the menu, I need to know where to get to the value "Contains".

When I try to get it from column.CurrentFilterFunction, I get an empty string. I was assuming that the CurrentFilterFunction property was what I was looking for, but I guess not.

Is there a way to get this value programmatically?

Thanks,
Eric
Antonio Stoilkov
Telerik team
 answered on 18 May 2012
2 answers
739 views
Hi there,

Ok this might sounds pretty easy and shouldn't be such a pain to do but I'm struggling resizing a RadTextBox. I did something as simple as this :
<telerik:RadTextBox ID="rtbAddress" runat="server" Label="Address:" ToolTip="Search for an address" Width="300px" Columns="200">

And still, no way to change the size of the input neither to get the input next to its label... How come is this so difficult to achieve ?
All I need is a text box that match the radtextbox1.png and not the radtextbox2.png .

Plus when I remove the Width property to use the Columns property, the input simply disappears and all I see is the label ????

This is so simple that it is pissing me off. Please someone has any idea ?

Christophe
Top achievements
Rank 1
 answered on 18 May 2012
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?