Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
246 views
I have a treeview, that depending on if a check box is check will display either only nodes that are flagged as "Enabled" in the database, or all nodes. Depending on if a node is set as enabled I would like to attach one of two context menu's to it. 

This is the error message I'm getting: 
"Multiple controls with the same ID 'contextMenu1' were found. FindControl requires that controls have unique IDs."

This error occurs when I toggle the check box a couple times.

Below is my code:

<span>Show All Locations:</span>
       <asp:CheckBox ID="LocationsTreeView_ChkBox" runat="server" AutoPostBack="true" OnCheckedChanged="LocationsTreeView_CheckedChanged" Checked="false" />
           <telerik:RadTreeView ID="LocationsTreeView" runat="server" EnableDragAndDrop="true"  MultipleSelect="true" EnableDragAndDropBetweenNodes="true"
           AllowNodeEditing="true" OnContextMenuItemClick="LocationsTreeView_ContextMenuItemClick" OnClientContextMenuItemClicking="onClientContextMenuItemClicking"
           OnClientContextMenuShowing="onClientContextMenuShowing" OnNodeEdit="LocationsTreeView_NodeEdit"
           OnNodeDrop="LocationsTreeView_NodeDrop" OnClientNodeDropping="onNodeDropping" OnClientNodeDragging="onNodeDragging" >
    
           </telerik:RadTreeView>


protected void LocationsTreeView_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox)sender;
 
            if (cb.Checked == true)
                LocationTreeAll();
 
            else if (cb.Checked == false)
                LocationTree();
        }


public void LocationTreeContextMenu()
       {
           // Define Context Menu 1 ## Enable Menu Item
           // Define Context Menu 2 ## Disable Menu Item
 
           RadTreeViewContextMenu contextMenu1 = new RadTreeViewContextMenu();
           RadTreeViewContextMenu contextMenu2 = new RadTreeViewContextMenu();
           contextMenu1.ID = "contextMenu1";
           contextMenu2.ID = "contextMenu2";
            
           // Build Menu's
            
           RadMenuItem menuItem1 = new RadMenuItem();
               menuItem1.Value = "Rename";
               menuItem1.Text = "Rename ...";
               menuItem1.Enabled = true;
               menuItem1.ImageUrl="images/icons/edit_48.png";
               contextMenu1.Items.Add(menuItem1);
               contextMenu2.Items.Add(menuItem1);
           RadMenuItem menuItem2 = new RadMenuItem();
               menuItem2.IsSeparator = true;
               contextMenu1.Items.Add(menuItem2);
               contextMenu2.Items.Add(menuItem2);
           RadMenuItem menuItem3 = new RadMenuItem();
               menuItem3.Value = "addLocation";
               menuItem3.Text = "Add Location";
               menuItem3.Enabled = true;
               menuItem3.ImageUrl = "images/icons/add_16.png";
               contextMenu1.Items.Add(menuItem3);
               contextMenu2.Items.Add(menuItem3);
           RadMenuItem menuItem4 = new RadMenuItem();
               menuItem4.Value = "enableLocation";
               menuItem4.Text = "Enable Location";
               menuItem4.Enabled = true;
               contextMenu1.Items.Add(menuItem4);
           RadMenuItem menuItem5 = new RadMenuItem();
               menuItem5.Value = "disableLocation";
               menuItem5.Text = "Disable Location";
               menuItem5.Enabled = true;
               contextMenu2.Items.Add(menuItem5);
           RadMenuItem menuItem6 = new RadMenuItem();
               menuItem6.Value = "editDetails";
               menuItem6.Text = "Edit Details";
               menuItem6.Enabled = true;
               menuItem6.PostBack = true;
               contextMenu1.Items.Add(menuItem6);
               contextMenu2.Items.Add(menuItem6);
 
           // Add The context menu to the tree
           LocationsTreeView.ContextMenus.Add(contextMenu1);
           LocationsTreeView.ContextMenus.Add(contextMenu2);
 
           // Check to see which node gets which context menu
           foreach (RadTreeNode node in LocationsTreeView.GetAllNodes())
           {
               string check = "";
               string getStatus = "SELECT Enabled FROM dbo.Locations WHERE ID='" + node.Value.ToString() + "'";
 
               SqlCommand cmd = new SqlCommand(getStatus,connection);
               connection.Open();
               check = cmd.ExecuteScalar().ToString();
               connection.Close();
               cmd.Dispose();
 
               if (check == "True")
               {
                   node.ContextMenuID = "contextMenu2";
               }
               else if (check == "False")
               {
                   node.ContextMenuID = "contextMenu1";
               }
           }
       }
William
Top achievements
Rank 1
 answered on 23 Nov 2011
5 answers
1.5K+ views
Hi,

I was wondering if there was a way to set the default date on the pop up calendar of a date picker without entering the date in the input box?

Regards
Roger
Maria Ilieva
Telerik team
 answered on 23 Nov 2011
1 answer
70 views
I have customized my AppointmentTemplate by adding some controls (Labels and ImageButtons).
I need to access those controls to change values based on info I have in my Appointment object.
My first approach was just using Eval() to toggle the visibility of a LinkButton in the markup based on a custom attribute like this:
            <AppointmentTemplate>
                <p>
                    <h2><%# Eval("Subject") %></h2><br />
                </p>
                <p>
                    <h3><%# string.IsNullOrEmpty(Eval("Attributes['gst_name']").ToString().Trim()) ? "" : "with: " + Eval("Attributes['gst_name']") %></h3>
                </p>
                <p>
                     <asp:ImageButton id= "ibNotes" ImageUrl="~/Images/note.png" runat="server" CommandName="GetNote" Visible = "<%# Eval("Attributes['notelength']") = "0" ? "false" : "true" %>"/>

                </p>
                <p>
                    <h3>AppointmentTemplate<%# Eval("Attributes['modifiers']") %></h3>
                </p>
            </AppointmentTemplate>

But I can't build with it this way. I get an error: "The server tag is not well formed." Referring to my ImageButton location.

So I tried another approach, to get to it in codebehind, but I can't get anything working there either.
What server side event should I use? I'm thinking I'd need to use FindControl() but can't find anything in Intellisense.

Anyone got an example?

Thanks!

Matt
Peter
Telerik team
 answered on 23 Nov 2011
5 answers
121 views
hi,

I have a scheduler on an MVC page, doing web-services mode.

In my case the week view and the month view need a different row height. The days have a row corresponding to 5 minutes, which works well with a small row height. This results in the month view looking awful.

I want to change the row height when switching view. There is an event on switching view, this is a server-side. My scheduler is running client-side (no choice doing mvc). I'm looking for a way to hook into the view-change client side.

Any help appreciated

Peter 
Peter
Telerik team
 answered on 23 Nov 2011
3 answers
227 views
Hi,
I have a RadToolBarSplitButton where I set buttons in runtime.
I calcule the dropdown height from the number of  button.

But everyime the vertical scroll bar are visible.

How do you remove this scroll bar ?

int dropDownHeight = (int)(Annees.Buttons.Count * 25);
if (dropDownHeight > 250)
{
   dropDownHeight = 250;
   //show vertical scroll bar
}
else
{
  //not show vertical scroll bar
}
                         
Annees.DropDownHeight = Unit.Pixel(dropDownHeight);
Stephane
Top achievements
Rank 1
 answered on 23 Nov 2011
5 answers
220 views
hi,

I'm using a scheduler in an MVC page, doing web services mode.

I do have a issue with the localization.
The locale of scheduler, bowser and page are all set to Dutch 
My localized resources work fine
The popup calendar for selecting a date is in Dutch
The format of date and time follows my custom formats

Nevertheless the names of the day of the week and the month names are still in English. How can I tame this detail ?

Peter
Peter
Telerik team
 answered on 23 Nov 2011
9 answers
425 views

Hello.

In my web application, a page is displayed with the RadScheduler component, whose ColumnWidth property has been set to a certain number of pixels.

When an appointment is displayed, it does not fill the entire cell; a certain space is left on the right side, just like in the following demo: http://demos.telerik.com/aspnet-ajax/scheduler/examples/customization/defaultcs.aspx.

What should I do to set the width of the appointment equal to RadScheduler ColumnWidth?

Thank you.

Paulo

Peter
Telerik team
 answered on 23 Nov 2011
1 answer
215 views
I put in what I thought was some simple code:

           <div id="divRight1stRow" class="float_right" style="padding: 6px;">
                <div class="float_right">
                     <telerik:RadButton Width="25px" Height="26px" ID="btnAdmin" runat="server" Text="Administration" OnClientClicked="btnAdmin_Click">
                    <Image ImageUrl="~/images/administration_25x26.png"/>
                    </telerik:RadButton><br />
                </div>
                <div class="float_right">
                     <telerik:RadButton Width="75px" Height="26px" ID="btnLogout" runat="server" Text="Logout" OnClick="btnLogout_Click" CssClass="margin_right">
                    <Image ImageUrl="~/images/logout_v1_75x26.png" />
                     </telerik:RadButton><br />
                </div>
                <div class="float_right">
                    User: <asp:Label ID="lblUserName" runat="server" Text="" CssClass="margin_right"></asp:Label>
                </div>
                <div class="float_right">
                    <asp:Label ID="LblDept" runat="server" Text="Department:&nbsp;" CssClass="margin_right"></asp:Label>
                    <telerik:RadComboBox ID="RadCbBoxDepts" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadCbBoxDepts_SelectedIndexChanged1"  CssClass="margin_right">
                    </telerik:RadComboBox>
                </div>
            </div>

The problem is I do not see the buttons until i mouse over the area. Any Ideas what is going on?

Slav
Telerik team
 answered on 23 Nov 2011
0 answers
93 views
Hello ,

recently i am working on Email functionality and in that we had a grid to which we have to bind a check box  which has functions like Check all, None,Read,Unread  how to implement this using radgrid,please respond if u have any idea.

Regards,
Madhukar.
Saimadhukar
Top achievements
Rank 1
 asked on 23 Nov 2011
13 answers
248 views
I have a tooltip solution that was working under Q3.1208 that breaks when I upgrade to Q3.1314.  I have a static tooltip in the HTML like this:

    <telerik:RadToolTip ID="rttConfigPanel" runat="server" Modal="true" ShowCallout="true" 
        ShowDelay="0" HideDelay="500" HideEvent="ManualClose" Title="Widget Configuration" 
        ShowEvent="FromCode" TargetControlID="tabLayoutTabs"
        <iframe id="iFrameConfigPanel" src=""></iframe> 
    </telerik:RadToolTip> 

I have a Javascript function on the same page that reveals the tooltip:

        function showToolTip(sender, args) { 
            // cause the tooltip to appear near the command icon that triggered it 
            var tooltip = $find("<%=rttConfigPanel.ClientID %>"); 
            tooltip.set_targetControl(args.Command.get_element()); 
            tooltip.show(); 
 
            // send a fresh querystring to the config panel so it doesn't load from cache 
            var sURL = "WidgetConfigPanel.aspx"
            var oDate = new Date(); 
            var iframe = document.getElementById("iFrameConfigPanel"); 
            sURL = sURL + "?id=" + args.Command.get_name(); 
            sURL = sURL + "&RandomNumber=" + oDate.getHours() + "-" + oDate.getMinutes() + "-" + oDate.getMilliseconds(); 
            iframe.src = sURL; 
        } 

The function gets when the user clicks a (custom) RadDock command button.  It's set up like this:

Dim cmd As New DockCommand() 
cmd.CssClass = WidgetCommandIconCssClasses.CommandConfig 
cmd.Name = WidgetCommands.ConfigPanel + View.LayoutDockId.ToString() 
cmd.AutoPostBack = False ' this command is handled on the client 
cmd.OnClientCommand = "showToolTip" 
cmd.Text = "Configuration Panel" 
 

So, the user clicks the custom command button on the RadDock, the ToolTip (with IFrame) is shown, and the IFrame content is customized to the dock the user clicked on. 

As I say, this works fine with the Q3.1208 release, but the Q3.1314 release breaks it.  The behavior is that the tooltip is shown with only the Text inside it (Configuration Panel).  The IFrame codebehind does get called (I observe while debugging), but the content is never shown.  It's the same if I replace the IFrame with plain text. 

The "break" seems to happen with the set_targetControl function.  It (correctly) moves the ToolTip to the right control, but it seems to be hiding the content.  If I remove that line from the Javascript, it functions correctly, except the ToolTip is not positioned where I want it.

Am I doing something wrong, or is there a problem with Q3.1314?

Thank you!


Marin Bratanov
Telerik team
 answered on 23 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?