Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
65 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
317 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
447 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
1 answer
94 views
is it possible to get radgrid changes on postback? pretty much is there a radgrid equivalent of textbox.text?
Pavlina
Telerik team
 answered on 21 Nov 2014
3 answers
596 views
Hi,

May i know the code to select out all items in radgrid in all the pages? As sometimes when i do filtering, i need all the items from whole grid (grid with paging) to display in other places.

I cannot use code as below, as it just select out just one page from the grid only.

For Each griditem As Telerik.WebControls.GridItem In radgrid.Items
Next


Please advice.

Thanks,
Soo


Pavlina
Telerik team
 answered on 21 Nov 2014
1 answer
123 views
Hi,

I am using Telerik Asp.Net for Ajax version 2014.3.1024.40.

I have enabled virtual scrolling the drop down list as below. I am able to see only the Afghanistan, all the others are shown as blank value. However i disable the virtual scrolling, i am able to see all the entries. Please let me know whats the issue and how to fix it ?

<telerik:RadDropDownList ID="rdlCountry" DefaultMessage="---" EnableVirtualScrolling="true"  runat="server"  >
                                                            <Items>
                                                                <telerik:DropDownListItem Text="Afghanistan" />
                                                                <telerik:DropDownListItem Text="Albania"  />
                                                                <telerik:DropDownListItem Text="Algeria" />
                                                                <telerik:DropDownListItem Text="Andorra" />
                                                                <telerik:DropDownListItem Text="Angola" />
                                                                <telerik:DropDownListItem Text="Antigua & Deps" />
                                                                <telerik:DropDownListItem Text="Argentina" />                                                             
                                                            </Items>
                                                        </telerik:RadDropDownList>
Nencho
Telerik team
 answered on 21 Nov 2014
3 answers
470 views
In this simple example (found here in the forum) for setting the filtering in code behind I get a "Expression Expected"  error.

I have already set the EnableLinqExpression="false" in the grid.

public enum MyEnum
{
    Value1,
    Value2,
    Value3,
    Value4,
    Value5
}
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        if (RadGrid1.MasterTableView.FilterExpression == "")
        {
            RadGrid1.MasterTableView.FilterExpression = "([Value] = '" + MyEnum.Value1 + "')";
        }
        else
        {
            RadGrid1.MasterTableView.FilterExpression = "";
        }
        RadGrid1.Rebind();
    }
 
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable table = new DataTable();
        table.Columns.Add("Key");
        table.Columns.Add("Value");
        for (int i = 1; i < 6; i++)
        {
            table.Rows.Add("Key" + i.ToString(), "Value" + i.ToString());
        }
        RadGrid1.DataSource = table;
    }
}

<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <h2>Test Grid filtering</h2>
        <telerik:RadButton ID="RadButton1" runat="server" onclick="RadButton1_Click"
            Text="RadButton">
        </telerik:RadButton>
    </div>
    <telerik:RadGrid ID="RadGrid1" runat="server" EnableLinqExpression="false" AllowFilteringByColumn="true"
        onneeddatasource="RadGrid1_NeedDataSource" Width="500px">
    </telerik:RadGrid>
    </form>
</body>
</html>

What are I doeing vrong?

Anders Pedersen
Anders
Top achievements
Rank 1
 answered on 21 Nov 2014
1 answer
138 views
Hi, 
I need to customize telerik slider to obtain something like the attached image.

Any help will be appreciated.
Thank you.
Ianko
Telerik team
 answered on 21 Nov 2014
1 answer
139 views
how do you reset a grid, in batch edit mode, to its original state after an update? ie, clear whatever tracked changes it has going on so that if i click save changes again it doesn't still think there are commands to process

when i add an item, save changes, and then edit the same item (or do nothing to it) i get an update command with an oldvalues count of 0 and a null newvalues object. which feels less like an update than a not anything at all. if i could reset the grid after each save changes it wouldn't be an issue
Viktor Tachev
Telerik team
 answered on 21 Nov 2014
4 answers
96 views
Hi All,

I have IList<Class1>. My Class1 has two property. Say Name and ID Now I want. Dynamic Order By On Both Property.
OrderBy Should Be Ascending or Descending.

How can I achieve this functionality.

I am using this as            
var data = RadGrid.GetBindingData(retval.AsQueryable(), startIndex, maximumRows, sortBy, filterExpressions);

in sort by it only take the property name. so how can specify the sort order.

Please Help

Regards
Vijay



Angel Petrov
Telerik team
 answered on 21 Nov 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?