Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
88 views
I would like to add a control (ie: button) to the header of my node, essentially to the right of the rendered text field.  

I have an Item template defined for the data bound items, but haven't be able to figure out how to add a control to the node or specify a template for the node itself.

See attached picture for an example of what I am trying to achieve.
Peter Filipov
Telerik team
 answered on 24 Nov 2014
1 answer
204 views
Hi all,

I am experiencing some strange things. It could be safari/ios, but my dropdownlist used to worked
on safari, iphone and ipad. But it's not working anymore due to an update i guess.

When i click on the drop down-arrow, nothing happens.
Is there anyone who can give me a help on this

thanks

Richard


Dimitar
Telerik team
 answered on 24 Nov 2014
1 answer
188 views
is there any way to wait for savechanges to complete before calling another action? i need to make sure my form doesn't submit until it's finished. and then i need to submit my form
Maria Ilieva
Telerik team
 answered on 24 Nov 2014
1 answer
191 views
I have a requirement to display data in a ASP.NET grid.  The columns are dynamically created as the table source is selected by the user and is not known at design time.  I am able to build the data table with the respective column names and display the data in the grid.  This is working OK, but I also have a requirement to color code specific columns.  The data source that I am display is the results on a data compare process so I have columns named MYFIELD1_S and MYFIELD1_T where the _S and _T represents the source and target.  I am need to compare the values in MYFIELD1_S versus MYFIELD1_T and if the values are different then color code MYFIELD1_T. 

I have some logic that is looking for the column name ending with "_T", get the column index and compare it to the column index-1 (i.e. the _S column).  But I have been having a hard time getting the column index.  I have tried the ItemCreated and ItemDataBound events without any luck and have looked at prerender.  I have this function working perfectly for a WinForm grid using CellFormatting event, but this does not exist in ASP.NET and we are moving from a WinForm app to ASP.NET

How is the best way to handle this requirement?
Scott Manning
Top achievements
Rank 1
 answered on 24 Nov 2014
7 answers
176 views
Hello,

I am working on a project with RadGrid.

My site is multilingual and therefore I use RadGrid.Main.resx.
There is a problem / bug in RTL languages.
If I use DateRange filter and I use Hebrew as my language:
A. The fields “From” and “To” are not translated into Hebrew.
B. The filter is not up to par with RTL, but remained in LTR / or it aligns wrong is not exactly clear. See attached picture

 I will be happy to receive a solution.

Thanks,
Daniel
Daniel
Top achievements
Rank 1
 answered on 23 Nov 2014
0 answers
68 views
Hi All,
I am using the below code to refresh a radgrid on radwindow close but this is the error i get. Can anyone help me solve this.
Error
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)

Aspx
     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
        onajaxrequest="RadAjaxManager1_AjaxRequest">  
        <AjaxSettings>  
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls>  
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />  
                </UpdatedControls>  
            </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls>  
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />  
                </UpdatedControls>  
            </telerik:AjaxSetting>  
        </AjaxSettings>  
    </telerik:RadAjaxManager> 
  
                                      <script type="text/javascript">
                                          function closeRadWindow() {
                                              $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
}
</script> 

Code
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
            {
            RadGrid1.MasterTableView.SortExpressions.Clear();
            RadGrid1.MasterTableView.GroupByExpressions.Clear();
            RadGrid1.Rebind();
            } 

        }

Thanks in advance
Edd
Top achievements
Rank 1
 asked on 23 Nov 2014
2 answers
132 views
Hello,

I am working on a project with RadGrid.

I am trying to create a FilterTemplate like this video:
http://youtu.be/jOY3NFzdoVY

This is FilterTemplate’s code, created in the designer:
<FilterTemplate>
                            <telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemOpened="itemOpened">
                                <Items>
                                    <telerik:RadMenuItem PostBack="false" Text="Date Filter">
                                        <ContentTemplate>
                                            <div id="DateFilterDivWrapper" class="Wrapper">
                                                <table id="DateFilterTable">
                                                    <tr>
                                                        <td class="CustomFilter">
                                                            <asp:Label ID="lbl_From" runat="server" Text="From"></asp:Label>
                                                        </td>
                                                        <td class="CustomFilter">
                                                            <telerik:RadDateTimePicker ID="dt_picker_From" runat="server"></telerik:RadDateTimePicker>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="CustomFilter">
                                                            <asp:Label ID="lbl_To" runat="server" Text="To"></asp:Label>
                                                        </td>
                                                        <td class="CustomFilter">
                                                            <telerik:RadDateTimePicker ID="dt_picker_To" runat="server"></telerik:RadDateTimePicker>
  
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" style="text-align: center;" class="CustomFilter">
                                                            <telerik:RadButton ID="btn_Filter_Date" runat="server" Text="Filter"></telerik:RadButton>
                                                        </td>
                                                    </tr>
                                                </table>
  
  
                                            </div>
                                        </ContentTemplate>
                                    </telerik:RadMenuItem>
                                </Items>
                            </telerik:RadMenu>
  
                        </FilterTemplate>

However, I want to code to be code-behind, like this:
01.Private Sub RadGrid1_ColumnCreated(sender As Object, e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
02.        If e.Column.ColumnType = "GridDateTimeColumn" Then
03.            Dim xx As New MyCustomFilteringColumn
04.            e.Column.FilterTemplate = xx
05.        End If
06.    End Sub
07. 
08.Public Class MyCustomFilteringColumn
09.    Implements ITemplate
10.  
11.    Public Sub InstantiateIn(container As Control) Implements ITemplate.InstantiateIn
12.        Dim RadMenuItem_DivDate As New RadMenuItem
13.        Dim insidMenuControl As New Control
14.  
15.  
16.        Dim lbl_From, lbl_To As New Label()
17.        Dim dt_picker_From, dt_picker_To As New RadDateTimePicker
18.        Dim btn As New RadButton()
19.        lbl_From.ID = "lbl_From"
20.        lbl_To.ID = "lbl_To"
21.        lbl_From.Text = "From" 'can take from resource  (all the .text)
22.        lbl_To.Text = "To"
23.        dt_picker_From.ID = "dt_picker_From"
24.        dt_picker_To.ID = "dt_picker_To"
25.        btn.ID = "btn_Filter"
26.        btn.Text = "Filter"
27.  
28.  
29.  
30.  
31.  
32.        insidMenuControl.Controls.Add(New Literal With {.Text = "<div id=""DateFilterDivWrapper"">"})
33.        insidMenuControl.Controls.Add(New Literal With {.Text = "<table id=""DateFilterTable""> <tr>  <td>"})
34.        insidMenuControl.Controls.Add(lbl_From)
35.        insidMenuControl.Controls.Add(New Literal With {.Text = "</td> <td>"})
36.        insidMenuControl.Controls.Add(dt_picker_From)
37.        insidMenuControl.Controls.Add(New Literal With {.Text = "</td>  </tr> <tr> <td>"})
38.        insidMenuControl.Controls.Add(lbl_To)
39.        insidMenuControl.Controls.Add(New Literal With {.Text = " </td> <td>"})
40.        insidMenuControl.Controls.Add(dt_picker_To)
41.        insidMenuControl.Controls.Add(New Literal With {.Text = "</td>  </tr> <tr>   <td colspan=""2"" style=""text-align:center;"">"})
42.        insidMenuControl.Controls.Add(btn)
43.        insidMenuControl.Controls.Add(New Literal With {.Text = "  </td> </tr>  </table>"})
44.        insidMenuControl.Controls.Add(New Literal With {.Text = "</div>"})
45.  
46.        RadMenuItem_DivDate.PostBack = False
47.        RadMenuItem_DivDate.Text = "Date Filter"
48.  
49.        RadMenuItem_DivDate.ContentTemplate.InstantiateIn(insidMenuControl)
50.  
51.        Dim RadMenu_DateFilter As New RadMenu
52.        RadMenu_DateFilter.ID = "RadMenu_DateFilter"
53.        RadMenu_DateFilter.OnClientItemOpened = "itemOpened"
54.        RadMenu_DateFilter.Items.Add(RadMenuItem_DivDate)
55.  
56.        container.Controls.Add(RadMenu_DateFilter)
57.  
58.    End Sub
59.End Class

However, when I try to transfer the above code to code-behind I receive the following exception (It occurs on line 49):
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

I would be happy to get a code-behind solution.

Thank you,
Daniel.
Daniel
Top achievements
Rank 1
 answered on 23 Nov 2014
4 answers
64 views
Hello, very new to Telerik products and am having a difficult time getting the model window to appear from the menuitem,  I am hitting my javascript code ok and now errors are incurred, in fact it appears very briefly.  As you can see from the code below, I also implement via a button which launches fine, but now what I need.  Please help.  thanks

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RavnHost.aspx.cs" Inherits="RAVN_FMEC2.RavnHost" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>RAVN_FMEC2</title>

<%-- <script language="javascript" type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/jquery-ui-1.8.20.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/jquery-ui-8.20.min.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/jquery-1.7.1.js"></script>--%>


<script>

function MenuItemClicked(sender, args) {
// var item = args.get_item();

var item1 = args._item._text

if (item1 == "Load") {
var oWindow = $find("RadWindow1");
oWindow.setUrl("LoadRavn.aspx");
oWindow.show();



//openModalWindow();

//var WinSettings = "center:yes;resizable:no;dialogHeight:550px;dialogWidth:500px;";
//var MyArgs = window.showModalDialog("LoadRavn.aspx", MyArgs, WinSettings);

//if (MyArgs == null) {
// window.alert("Nothing returned from Load Dialog. No changes will be made");
//}
//else {
// $("#tbRDCName").val(MyArgs[0].toString());
//}
}
else if (item1 == "Save") {
// var MyArgs = new Array($("#hdnRdcId").val());
// var WinSettings = "center:yes;resizable:no;dialogHeight:600px;dialogWidth:500px;";
// MyArgs = window.showModalDialog("SaveDialog.aspx", MyArgs, WinSettings);

// if (MyArgs == null) {
// window.alert("Nothing returned from Save Dialog. No changes will be made");
// }
// else {
// $("#tbRDCName").val(MyArgs[0].toString());
// }
}
else {
alert("Item with text '" + text + "' not found.");
}
}

function openModalWindow() {
$("#dialog").dialog({
modal: true,
height: 570,
width: 725,
open: true
});
}

function clientShow(sender, eventArgs) {
var txtInput = document.getElementById("txtInput");
sender.argument = txtInput.value;
}
function clientClose(sender, args) {
if (args.get_argument() != null) {
alert("'" + sender.get_name() + "'" + " was closed and returned the following argument: '" + args.get_argument() + "'");
}
}



</script>

</head>

<body>
<form id="form1" runat="server">

<telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
</asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
</asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
</asp:ScriptReference>
</Scripts>
</telerik:RadScriptManager>

<asp:Table runat="server" Width="100%">
<asp:TableRow runat="server" Width="100%">
<asp:TableCell runat="server" Width="50%"></asp:TableCell>
<asp:TableCell runat="server" Width="50%" HorizontalAlign="Right">
<asp:Image runat="server" ID="imgNascar" ImageUrl="~/Images/NascarSmall.png" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server" Width="50%" HorizontalAlign="Left" VerticalAlign="Bottom" >
<telerik:RadMenu ID="RadMenu1" OnClientItemClicked="MenuItemClicked" OnItemClick="RadMenu1_ItemClick" runat="server">
<Items>
<telerik:RadMenuItem runat="server" Text="File" >
<Items>
<telerik:RadMenuItem runat="server" Text="Load" >
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Text="Save">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" SkinID="Windows7" Text="Print">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>&nbsp&nbsp;
<telerik:RadTextBox runat="server" ID="tbRDCName" Width="300px" ></telerik:RadTextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell1" runat="server" Width="50%" HorizontalAlign="Right" >
<asp:Label runat="server" ID="lbUserName" ></asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:HiddenField runat="server" ID="hdnRdcId" Value="20" />

<iframe runat="server" id="frameRavn" src="http://30.177.9.11:9050/" width="100%" height="600px" ></iframe>

<telerik:RadWindow ID="RadWindow1" runat="server" Modal="True" NavigateUrl="LoadRavn.aspx"
OnClientClose="clientClose" OnClientShow="clientShow" ReloadOnShow="true"
Height="580px" Width="750px" AutoSizeBehaviors="Width" VisibleStatusbar="False">
</telerik:RadWindow>

<%-- <telerik:RadWindow ID="RadWindow1" runat="server" Modal="True" NavigateUrl="LoadRavn.aspx"
OpenerElementID="showDialog" OnClientClose="clientClose" OnClientShow="clientShow" ReloadOnShow="true" Height="580px" Width="750px" AutoSizeBehaviors="Width" VisibleStatusbar="False">
</telerik:RadWindow> --%>

Type initial value here:
<br />
<asp:TextBox ID="txtInput" runat="server" /><br />
<asp:Button ID="showDialog" Text="Show Dialog" runat="server" />



</form>
</body>
</html>
Hugh
Top achievements
Rank 1
 answered on 23 Nov 2014
6 answers
307 views

Dear All,
Can someone please help me with AsyncUpload control inside RadGrid since I am really new with Telerik controls.

I have a DB table with column names as:

RecordID          Name          AttachmentPath
1                       Name1        ~/Attachments/File123_1.pdf
2                       Name2        ~/Attachments/File125_2.pdf

Below are what I did:

  1. Inserted RadGrid with its default functionality of Inserting, Editing, and Deleting. (Works Perfect)
  2. Inserted AsyncUpload control inside RadGrid for uploading files. (Works Perfect)

<telerik:GridTemplateColumn>
    <EditItemTemplate>
        <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" TargetFolder="~/Attachments"
    OnFileUploaded="RadAsyncUpload1_FileUploaded1">
        </telerik:RadAsyncUpload>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

3. Fired the OnFileUploaded event to upload control in a path. (Works Perfect)

protected void RadAsyncUpload1_FileUploaded1(object sender, FileUploadedEventArgs e)
{
    string rootPath = "~/Attachments/";
 
    string path = Server.MapPath(createSubFolder(rootPath));
    e.File.SaveAs(path + e.File.GetName());
}

Below are what I want:

  1. While adding new record & uploading file with it, the file should be renamed with the table Record ID of RadGrid as OrignalFileName + "_" + RecordID
  2. The FileName from point#1 should be stored in AttachmentPath (DB Column name).
  3. While editing a selected record from RadGrid, I should be also able to edit associated file such as delete the file, etc.

Point to be noted, I want only one file to be associated/attached per record.


Thanks In Advance,

Fawad Surosh

SANJAY
Top achievements
Rank 1
 answered on 22 Nov 2014
1 answer
446 views
Hi,

I have used RadComboBox inside my DetailsView. I send the value of combobox as comma separated to the database as (1,2,3,4). When I want to retrieve the data (1,2,3,4) from the database using SqlDataSource on edit mode of DetailsView, how can I set or bind the "Checked" values and display them as checked back in the combobox.

Here is what i have done:

--> WebForm1.Aspx

<%----------------------- DATA SOURCE FOR DELIVERABLE -------------------------%>
 
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ITSConnectionString %>"
            DeleteCommand="DELETE FROM [Deliverable] WHERE [DeliverableId] = @DeliverableId"
            InsertCommand="INSERT INTO [Deliverable] ([DeliverableTitle],[CCIds]) VALUES (@DeliverableTitle, @CCIds)"
            SelectCommand="SELECT * FROM [Deliverable] WHERE ([DeliverableId] = @DeliverableId)"
            UpdateCommand="UPDATE [Deliverable] SET [DeliverableTitle] = @DeliverableTitle, [CCIds] = @CCIds WHERE [DeliverableId] = @DeliverableId">
            <DeleteParameters>
                <asp:Parameter Name="DeliverableId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="DeliverableId" Type="int32" />
                <asp:Parameter Name="DeliverableTitle" Type="String" />
                <asp:Parameter Name="CCIds" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="DeliverableId" Type="int32" />
                <asp:Parameter Name="DeliverableTitle" Type="String" />
                <asp:Parameter Name="CCIds" Type="String" />
            </UpdateParameters>
   <SelectParameters>
      <asp:QueryStringParameter Name="DeliverableId" QueryStringField="DeliverableId" Type="Int32" />
   </SelectParameters>
</asp:SqlDataSource>
 
<%----------------------- DATA SOURCE FOR COMBOBOX -------------------------%>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ITSConnectionString %>" SelectCommand="SELECT [UserId], [DisplayName] FROM [Users]"></asp:SqlDataSource>
 
<%----------------------- THE DETAILS VIEW -------------------------%>
 
<asp:DetailsView ID="DetailsView1" runat="server" DefaultMode="Insert" AutoGenerateRows="False" DataKeyNames="DeliverableId" DataSourceID="SqlDataSource2" Height="50px" Width="125px" OnItemInserting="DetailsView1_ItemInserting" OnDataBinding="DetailsView1_DataBinding" OnDataBound="DetailsView1_DataBound">
            <Fields>
                <asp:BoundField DataField="DeliverableId" HeaderText="DeliverableId" InsertVisible="False" ReadOnly="True" SortExpression="DeliverableId" />
                <asp:BoundField DataField="DeliverableId" HeaderText="DeliverableId" SortExpression="DeliverableId" />
                <asp:BoundField DataField="DeliverableTitle" HeaderText="DeliverableTitle" SortExpression="DeliverableTitle"/>
                <asp:TemplateField>
                    <ItemTemplate>
                     <telerik:RadComboBox ID="CCIds" Text='<% #Bind("CCIds") %>' runat="server"
                         DataSourceID="SqlDataSource1" DataTextField="DisplayName"  DataValueField="UserId"
                         CheckBoxes="true"></telerik:RadComboBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" />
                <asp:ButtonField Text="Insert" CommandName="Insert" />
                <asp:ButtonField Text="Update" CommandName="Update" />
            </Fields>
        </asp:DetailsView>

--> WebForm1.Aspx.CS


public string GetCheckBoxValues(string RadComboBoxName)
        {
            RadComboBox rcb = (RadComboBox)DetailsView1.FindControl(RadComboBoxName);
            var collection = rcb.CheckedItems;
            StringBuilder sbValues = new StringBuilder();
            if (collection.Count != 0)
            {
                foreach (var item in collection)
                {
                    sbValues.Append(item.Value);
                    sbValues.Append(Delimiter);
                }
                if (sbValues.ToString().EndsWith(Delimiter))
                    sbValues.Remove(sbValues.Length - 1, 1);
            }
            return sbValues.ToString();
        }
         
        // Get the comma separate values and insert them into the DB.
        protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            string CCIds = GetCheckBoxValues("CCIds");
            if (CCIds != null)
            {
                e.Values["CCIds"] = CCIds;
            }
         }


Now how can I get the comma separated values and bound them with the combobox so that it should check only those items.
Fawad
Top achievements
Rank 1
 answered on 22 Nov 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?