Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
121 views
Hello,

is it possible to change the value returned by the SelectedValue when there is nothing selected?
I need this because it returns 0, and that unfortunatelly is a valid id in the database, and when there is nothing selected it shouldn't retrieve anything from the database, and it is retrieving, and that's just weird.

Thanks!
Tiago Ribeiro
Tiago
Top achievements
Rank 1
 answered on 28 Jul 2011
7 answers
238 views
I have a RadWindow that is used to update values. When the button is clicked and the event is finished the whole page reloads. I would like to apply some Ajax to the RadWindow so that the whole page doesn't reload when the update is complete, just the RadWindow closes. Below is the code I have so far:

ASP.NET

<telerik:RadAjaxLoadingPanel ID="LocationsLoadingPanel" runat="server" Transparency="30" Skin="Vista"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel ID="LocationsPanel" runat="server" LoadingPanelID="LocationsLoadingPanel">
            <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">
             <ContextMenus>
                    <telerik:RadTreeViewContextMenu ID="MainContextMenu" runat="server">
                        <Items>
                            <telerik:RadMenuItem Value="Rename" Text="Rename ..." Enabled="true" ImageUrl="images/icons/edit_48.png"
                                PostBack="false">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem IsSeparator="true">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Value="addLocation" Text="Add Location" ImageUrl="images/icons/add_16.png">
                            </telerik:RadMenuItem>    
                            <telerik:RadMenuItem Value="editDetails" Text="Edit Details" PostBack="true" />                
                        </Items>
                        <CollapseAnimation Type="none" />
                    </telerik:RadTreeViewContextMenu>
                </ContextMenus>
            </telerik:RadTreeView>
            <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" DecoratedControls="All" />
            <telerik:RadWindow ID="editDetails_RadWindow" runat="server" Modal="true" Behaviors="Close"
                Width="300px" Height="150px" DestroyOnClose="true" VisibleStatusbar="false"  >
                <ContentTemplate>
                    <table>
                        <tr>
                            <td><asp:Label ID="editDetailsIDlbl" Text="ID: " runat="server" /></td>
                            <td><telerik:RadTextBox ID="editDetailsIDtxt" runat="server" Enabled="false"/>
                                <asp:Label ID="InjectScript" runat="server" /></td>
                        </tr>
                        <tr>
                            <td><asp:Label ID="editDetailsCostCtrLbl" Text="Cost Center:" runat="server" /></td>
                            <td><telerik:RadTextBox ID="editDetailsCostCtrTxt" runat="server" EmptyMessage="Enter Cost Center" />
                            </td>
                        </tr>
                        <tr>
                            <td><asp:Label ID="editDetailsAuxLocLbl" Text="Aux Location: " runat="server" /></td>
                            <td><telerik:RadTextBox ID="editDetailsAuxLocTxt" runat="server" EmptyMessage="Enter Aux Location" /></td>
                        </tr>
                        <tr>
                            <td colspan="2"><telerik:RadButton ID="editDetailsUpdateBtn" runat="server" Text="Update" CommandArgument="LocationID" OnClick="editDetailsUpdateBtn_Click" /></td>
                        </tr>
                    </table>
                </ContentTemplate>
            </telerik:RadWindow>
            <telerik:RadWindowManager ID="locationRadWindow" runat="server"  />
        </telerik:RadAjaxPanel>


C#

protected void LocationsTreeView_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
 {
     RadTreeNode clickedNode = e.Node;
 
     switch (e.MenuItem.Value)
     {
         case "addLocation":
             RadTreeNode newLocation = new RadTreeNode(string.Format("New Location"));
             newLocation.Selected = true;
             newLocation.ImageUrl = clickedNode.ImageUrl;
 
 
             clickedNode.Nodes.Add(newLocation);
 
             clickedNode.Expanded = true;
             //update the number in the brackets
             if (Regex.IsMatch(clickedNode.Text, unreadPattern))
                 clickedNode.Text = Regex.Replace(clickedNode.Text, unreadPattern, "(" + clickedNode.Nodes.Count.ToString() + ")");
              
             clickedNode.Font.Bold = true;
             //set node's value so we can find it in startNodeInEditMode
              
             // Add Location Record to Database
             string ParentID = clickedNode.Value;
             Guid ID = Guid.NewGuid();
             string LocationID = ID.ToString();
 
             // Used for naming the node after adding it
             newLocation.Value = LocationID;
             startNodeInEditMode(newLocation.Value);
 
             string Name = newLocation.Text;
             LocationsTreeView_AddLocation(ParentID, LocationID, Name);
 
              
             break;
 
         case "editDetails":
 
             // Get the location of the item were editing
             string LocID = clickedNode.Value;
             string CostCtr = "";
             string AuxLoc = "";
 
             // Get Cost Center and Aux Location if it exists
             SqlCommand locationDetailsCmd = new SqlCommand("SELECT CostCenter, AuxLocationID FROM dbo.Locations WHERE ID='" + LocID + "'", connection);
             connection.Open();
             SqlDataReader rdr = locationDetailsCmd.ExecuteReader();
 
             while (rdr.Read())
             {
                 if (!rdr.IsDBNull(0))
                 CostCtr = rdr.GetString(0).ToString();
 
                 if (!rdr.IsDBNull(1))
                 AuxLoc = rdr.GetString(1).ToString();
             }
             connection.Close();
              
             editDetails_RadWindow.VisibleOnPageLoad = true;
 
             // Set the RadWindow TextBox Values
             editDetailsCostCtrTxt.Text = CostCtr;
             editDetailsAuxLocTxt.Text = AuxLoc;
             editDetailsIDtxt.Text = LocID;
             locationRadWindow.Windows.Add(editDetails_RadWindow);
             break;
     }
 }
 
protected void editDetailsUpdateBtn_Click(object sender, EventArgs e)
 {
     string AuxLocation = editDetailsAuxLocTxt.Text;
     string CostCenter = editDetailsCostCtrTxt.Text;
     string LocationID = editDetailsIDtxt.Text;
      
     SqlCommand editDetailsUpdateCmd = new SqlCommand("UPDATE dbo.locations SET CostCenter='" + CostCenter + "', AuxLocationID='" + AuxLocation + "' WHERE ID ='" + LocationID + "'", connection);
     connection.Open();
     editDetailsUpdateCmd.ExecuteNonQuery();
     connection.Close();
 
 }
William
Top achievements
Rank 1
 answered on 28 Jul 2011
0 answers
104 views
  • With Q2 2011 RadComboBox's empty message shows whenever there is no selected item even if the control is read-only (AllowCustomText=False, EnableLoadOnDemand=False). This has been a highly requested fix for the last couple of Qs in all of our support channels, so we finally implemented it although it may be a breaking change in some of your implementations.

In case it is a breaking change please consider retaining the previous functionality by using one of the two approaches:
  • for a data bound RadComboBox handle the OnDataBound event and select the first item (if it exists).
  • otherwise select the first item after you add items to the control.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 28 Jul 2011
1 answer
195 views
Hello,

How can I upload xml file using the RadEditor document manager.
Here is my code:
<telerik:RadEditor runat="server" ID="CntntRadEditor" Height="500px" Width="100%" style="z-index:1000;" Content='<%# DataBinder.Eval( Container, "DataItem.Cntnt") %>' ToolsFile="~/Common/Controls/RadEditor/xml/CustomFullSetOfToolsForSecureTables.xml">
                           <Modules>
                               <telerik:EditorModule Visible="false" />
                           </Modules>
                           <ImageManager ViewPaths="~/P/Design/Contents/Guide" UploadPaths="~/P/Design/Contents/Guide" DeletePaths="~/P/Design/Contents/Guide" />
                           <DocumentManager ViewPaths="~/P/Design/Contents/Guide" UploadPaths="~/P/Design/Contents/Guide" DeletePaths="~/P/Design/Contents/Guide" />
                       </telerik:RadEditor>

Please, I need your help in order to solve this problem.
It is appreciated to send me the modified code.

Regards,
Bader
Dobromir
Telerik team
 answered on 28 Jul 2011
3 answers
123 views
When bound to a webservice, how do I intercept whats going to show in the panel and show something custom?

I'm returning a serialized javascript object so I want to deserialize it, and just just ONE property of the object.

This is what I've been trying, but I think the cancel is stopping the content from showing in the panel?...or is this the wrong method?

function onSaveNotificationPanel_Updating(sender, args) {
    var callbackresult = Sys.Serialization.JavaScriptSerializer.deserialize(args.get_content());
     
    //Put the content into the panel
    args.set_cancel(true); 
    args.set_content(callbackresult.Message);
}
Svetlina Anati
Telerik team
 answered on 28 Jul 2011
2 answers
164 views
my radscheduler functions as follows:

double left click on a date: bring up advancedinserttemplate

this is working fine...

rightclick: context menu: delete and edit


when I click edit it is supposed to bring up my advancededittemplate

this is working on my local machine but for some reason when I move it over to my server I click edit in the contextmenu, and it just reloads the calendar...

any help would be really appreciated.

Thank you
Adam
Top achievements
Rank 1
 answered on 28 Jul 2011
1 answer
269 views

I can't seem to get a background of 100% width and height and a 30% opacity around the notification control. Is it even possible to do this? I realize it's just like a modal popup, but that's that point. I would love it if my notification controls could match the site more. Here is my code:

 

<style type="text/css"
  
.notificationContent 
  
{
  
display: inline-block; 
  
zoom: 1; 
  
*display: inline; 
  
width: 160px; 
  
vertical-align: bottom; 
  
}
  
.newBackground 
  
{
  
width: 100%; 
  
height: 100%; 
  
background-color:#666; 
  
filter:alpha(opacity=30); 
  
opacity:0.7; 
  
-moz-opacity:0.7; 
  
}
  
</style
  
<div class="newBackground"><telerik:RadNotification ID="RadNotification1" runat="server" Position="Center" Width="240"  Height="100" OnClientShowing="OnClientShowing" 
  
OnClientHidden="OnClientHidden" LoadContentOn="PageLoad" AutoCloseDelay="60000" 
  
 Title="Continue Your Session" TitleIcon="" Skin="Office2007" 
  
 EnableRoundedCorners="true" Animation="Fade" CssClass="newBackground"
  
 <ContentTemplate
  
 <div class="notificationContent"
  
 Time remaining:
  
    
  
<span id="timeLbl">60</span
  
<telerik:RadButton Skin="Office2007" ID="continueSession" runat="server" Text="Continue Your Session" Style="margin-top: 10px;"
  
</telerik:RadButton
  
</div>
  
</ContentTemplate>
  
</telerik:RadNotification></div
  
  
Svetlina Anati
Telerik team
 answered on 28 Jul 2011
1 answer
93 views
Hi,

I have  a treeview with parent node and child nodes. When clicked on any node, I need to have that node of the treeview expanded and clicked node to be disabled. The code below did not work.. I have tried setting a forecolor property to distinguish clicked node but that did not work either. Thanks for your help.  

 

Public Sub RadTreeView1_NodeClick1(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick
        e.Node.Expanded = True
        e.Node.Enabled = False
        'e.Node.ForeColor = Drawing.Color.Aqua
        If (e.Node.Value > 9000) Then
            Session("Page1ToNavigate") = e.Node.Text
            Response.Redirect("~/Page1.aspx")
  
        Else
  
            Session("Page2ToNavigate") = e.Node.Value
            Response.Redirect("~/Page2.aspx")
  
        End If
    End Sub

 

 

 

 

<telerik:RadPanelItem Text="Company View" Expanded="false" Font-Bold="true">
                                      <Items>
                                           <telerik:RadPanelItem >
                                            <ContentTemplate>
                           <telerik:RadTreeView ID="RadTreeView1" runat="server" DataSourceID="SqlDataSource4"
                                                       DataFieldID="UserID" DataFieldParentID="ParentID" DataValueField="UserID"
                                                       DataTextField="DisplayName" Skin="Outlook" >
                                                   </telerik:RadTreeView>
                       </ContentTemplate>
                                           </telerik:RadPanelItem>
Plamen
Telerik team
 answered on 28 Jul 2011
1 answer
117 views
Hai,

I have a scheduler and I have assigned Specific colours for diffrent Appointment Types.

When I move or resize the appointment, I want to update the DB through the "Ajax Call".

Though the DB and the Schuduler is updated with the Ajax Action, the colour of the moved or resized Appointment is lost.

What could be the reason ?

Any help will be appreciated.

with regards,

Roshil

Plamen
Telerik team
 answered on 28 Jul 2011
1 answer
58 views
Hello Support,

I had a requirment to design a navigation control with radtreeview using XML.

The treeview should expand to 1st level by default, from 1st level onwards the further levels need to be displayed as radmenu ie., on hover of treeview node on 1st level, i should display rest of the child nodes in a rad menu.

Any idea how to achive this?

Regards,
Suresh.
Plamen
Telerik team
 answered on 28 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?