Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
346 views
hi

Im facing here some dilema , I am using the radupload control to push some files to the server , they will be dropped in some folder i defined in the control with  TargetFolder , i have subscribed the FileExists event handler to check if some file with the same name exists on target everything is fine till here, the thing is that when a file is renamed to not overwrite another in the destination folder i cannot update its new name on the radupload control let me explain
void RadUpload1_FileExists(object sender, Telerik.Web.UI.Upload.UploadedFileEventArgs e)
       {
           int counter = 1;
           UploadedFile file = e.UploadedFile;
           string targetFolder = Server.MapPath(this.RadUpload1.TargetFolder);
           string targetFileName = System.IO.Path.Combine(targetFolder,
               file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
           while (System.IO.File.Exists(targetFileName))
           {
               counter++;
               targetFileName = System.IO.Path.Combine(targetFolder,
                   file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
           }
           file.SaveAs(targetFileName);
           file.FileName = System.IO.Path.GetFileName(targetFileName); // <---- this line here
            }

i need this because later i loop through uploaded files , and do some more processing on them ... i can think on several ways to go arround this but isnt conceptually wrong not beeing able to update the filename ???

thanks for your time , and i hope im not missing something obvious
Dimitar Terziev
Telerik team
 answered on 24 Oct 2011
1 answer
121 views

I’ve tried the following to clear all selection from a TreeList:

tlConfig.SelectedItems.Clear()

 

Nothing was removed from the selected collection. I then used the brute force method and it works:

For Each selectedItem As TreeListDataItem In tlConfig.SelectedItems

    selectedItem.Selected = False

Next

 

Am I missing something with the Clear() method?

Thanks,
Paul

Marin
Telerik team
 answered on 24 Oct 2011
1 answer
322 views
I'm not sure if anyone's asked about this specific issue before but I wasn't able to find it when I searched.  I'm trying to use a combobox as an autocomplete textbox using EnableLoadOnDemand but when I type into it it keeps giving me the javascript error: "There is no assigned data source.  Unable to complete callback request."  I was working when I first put it in but I can't seem to get it back to the way it was when it worked.  Is there anything anyone can think of that I can look at as to why it wouldn't be working.  These are the settings that I am setting in the codebehind.

combo.EnableAutomaticLoadOnDemand = true
combo.ItemsPerRequest = 15
combo.EnableVirtualScrolling = true
combo.ShowMoreResultsBox = true
combo.ShowDropDownOnTextboxClick = true
Princy
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
125 views
Hi

I am trying the RadScheduler for ASP.NET AJAX.

Scheduler displays the appointments correctly, however, I am receiving an 404 error from a WebResource request.

I managed to decrypt the request parameters and found that it says:

pTelerik.Web.UI.Skins|Telerik.Web.UI.Skins.Office2010Blue.Scheduler.rsAppointmentBg.png

Anybody has a clue how can this 404 error be corrected?

Regards
Arian
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
114 views
I'm getting an error: get_postBackElement().id' is null or not an object. This only occurs when I add in the RadAjaxManager, so I'm fairly sure it has something to do with that. This doesn't seem all that complicated. Am I missing something?

ASPX 

    <telerik:RadAjaxManager ID="RadAjaxManager222" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Timer1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="improvementRadGrid" LoadingPanelID="improvementLoading" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
 
 
<h1> Improvement Day Inventory </h1>
<br />
 
<telerik:RadAjaxLoadingPanel ID="improvementLoading" runat="server" />
<telerik:RadGrid ID="improvementRadGrid" runat="server" AutoGenerateColumns="false" DataSourceID="inventoryDataSource">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" />
            <telerik:GridBoundColumn DataField="Count" HeaderText="Quanitity" HeaderStyle-Font-Bold="true" ItemStyle-Font-Bold="true" />
            <telerik:GridBoundColumn DataField="MinimumQuantity" HeaderText="Min" />
            <telerik:GridBoundColumn DataField="MaximumQuantity" HeaderText="Max" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
 
<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick" />
 
<asp:SqlDataSource ID="inventoryDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AssetWhereConnectionString %>"
SelectCommand="ImprovementDay" SelectCommandType="StoredProcedure"></asp:SqlDataSource>


C#

public void Timer1_Tick(object sender, EventArgs e)
{
    improvementRadGrid.Rebind();
}
Iana Tsolova
Telerik team
 answered on 24 Oct 2011
1 answer
345 views
Hi telerik team,

This is my code here Delete command is not working. any body please help me,

aspx page:

<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"  CodeBehind="WebLunchMenu.aspx.cs"   Inherits="FSSAdminUI.WebLunchMenu" Title="Untitled Page" EnableEventValidation="false" %> this is page directive i have used

<telerik:RadGrid ID="gvWeblunchMenuItems" runat="server" Width="100%" CssClass="RadGrid"
                                GridLines="None" AllowPaging="True" PageSize="10" AllowSorting="True" AutoGenerateColumns="False"
                                ShowStatusBar="false" AllowAutomaticDeletes="false" AllowAutomaticInserts="false"
                                AllowAutomaticUpdates="false" HorizontalAlign="NotSet" OnItemDataBound="gvWeblunchMenuItems_ItemDataBound"
                                OnItemCreated="gvWeblunchMenuItems_ItemCreated" Style="margin-top: 0px" >
                                <PagerStyle HorizontalAlign="Center" Mode="NumericPages"></PagerStyle>
                                <MasterTableView CommandItemDisplay="Top" EditMode="PopUp">
                                    <HeaderStyle Font-Bold="true" Font-Names="Arial" />
                                    <Columns>
                                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmDialogType="RadWindow"
                                            ConfirmText="Do you want to delete the Calander" UniqueName="DeleteColumn" ButtonType="ImageButton"
                                            ImageUrl="~/image/Delete_Grd.png">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="25px"></ItemStyle>
                                        </telerik:GridButtonColumn>
                                        <telerik:GridBoundColumn UniqueName="WebCalID" HeaderText="Web CalID" DataField="WebCalID"
                                            Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText=" Calendar Name"
                                            UniqueName="TemplateColumn" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <asp:HiddenField ID="hdWebCalID" runat="server" Value='<%#Eval("WebCalID") %>'></asp:HiddenField>
                                                <asp:LinkButton ID="lbCalendarname" CommandName="Details" runat="server" Text='<%#Eval("Calendarname")%>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText=" Calendar Type"
                                            UniqueName="TemplateColumn" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCalendarType" runat="server" Text='<%#Eval("calendarType")%>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="SchoolNames" AllowSorting="False" ShowFilterIcon="False"
                                            HeaderText=" Assigned Schools" UniqueName="catagoryname" FilterControlWidth="50px">
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="300px"></ItemStyle>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="False" ShowFilterIcon="False" HeaderText="Edit Assigned Schools"
                                            UniqueName="TemplateColumn1" FilterControlWidth="30px">
                                            <ItemTemplate>
                                                <telerik:RadComboBox ID="rcschools" runat="server" Height="150px" Width="110px" DropDownWidth="200px"
                                                    Text="       -  Select  - " HighlightTemplatedItems="true" MarkFirstMatch="true"
                                                    EnableLoadOnDemand="true" Visible="true" OnClientFocus="OnFocus" EnableViewState="true"
                                                    ToolTip="Create" EmptyMessage="select" OnClientDropDownClosing="">
                                                    <ItemTemplate>
                                                        <table width="150px" border="0" cellspacing="1" cellpadding="0">
                                                            <tr>
                                                                <td align="left" width="50px">
                                                                    <asp:CheckBox runat="server" ID="chk1" Checked="false" />
                                                                </td>
                                                                <td align="left" width="150px">
                                                                    <asp:Label ID="lblSchoolname" runat="server" Text='<%#Eval("SchoolName")%>'></asp:Label>
                                                                    <asp:HiddenField ID="hdAvailableSchoolID" runat="server" Value='<%#Eval("Id") %>' />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        <center>
                                                            <asp:ImageButton ID="imgbtnAssign" ImageUrl="~/image/save_btn.gif" OnClientClick="showdisplaylayer();"
                                                                runat="server" OnClick="imgbtnAssign_click" /></center>
                                                    </FooterTemplate>
                                                </telerik:RadComboBox>
                                                <center>
                                                    <asp:ImageButton ID="imgbtnAS" ToollTip="Click here to Assign schools" BorderWidth="50px"
                                                        ImageUrl="~/image/Picked-Up.gif" runat="server" Visible="false" /></center>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    <CommandItemTemplate>
                                        <img src="~/image/AddRecordRad.gif" runat="server" style="cursor: hand;" id="imgShow"
                                            onclick="return ShowInsertForm();" alt="" />
                                        <a href="#" onclick="return ShowInsertForm();">Add new Calander</a>
                                    </CommandItemTemplate>
                                    <CommandItemStyle Height="30px" VerticalAlign="Middle" />
                                </MasterTableView>
                            </telerik:RadGrid>


cs page:


  protected void Page_Load(object sender, EventArgs e)
        {                     
         
            int pPageIndex = Convert.ToInt32(hdPageIndex.Value);
            int pPageSize = Convert.ToInt32(hdPageSize.Value);

            if (Request.QueryString["DistrictID"] != null)
            {
                Session["DistrictID"] = Request.QueryString["DistrictID"].ToString();// 33;
                hdDistrictID.Value = Request.QueryString["DistrictID"].ToString();
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }

           
                getWeblunchMenuItemsByKeyword(txtSearch.Text, pPageIndex, pPageSize);
                hdPopupResult.Value = "False";                      

           
            gvWeblunchMenuItems .DeleteCommand +=new GridCommandEventHandler(gvWeblunchMenuItems_DeleteCommand);
                       
        }

 void gvWeblunchMenuItems_DeleteCommand(object source, GridCommandEventArgs e)
        {
            int pPageIndex = Convert.ToInt32(hdPageIndex.Value);
            int pPageSize = Convert.ToInt32(hdPageSize.Value);
            string pKeyword = txtSearch.Text;

            int webcalID = Convert.ToInt32(((Telerik.Web.UI.GridTableRow)e.Item).Cells[3].Text);
            FSSAdmin.MenuLogic.WebLunchCalendar.DelWebLunchCalendarData(webcalID);
            FSSAdmin.MenuLogic.Cal.DelWebLunchSchedule(webcalID);
                
            getWeblunchMenuItemsByKeyword(txtSearch.Text, pPageIndex, pPageSize);
        }


gvWeblunchMenuItems_DeleteCommand event is not firing.
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
156 views
How can I make RadTextBox enter only numbers?
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
99 views
Hello,

I am using radupload.How can I check file size?
Shinu
Top achievements
Rank 2
 answered on 24 Oct 2011
1 answer
203 views
Hi there,

I am following the code from the link below. It is great. However, there are two questions that I would like to ask.
http://www.telerik.com/community/code-library/preview-thread/aspnet-ajax/grid/storing-multiple-grid-settings-in-database-via-profile.aspx

1. When I turn on AllowFilterByColumn, it works fine when I re-login. However, it does not display the value in the filter TextBox or CheckBox. For example, I put "Net 60 Days" in the filter TextBox and select "Contains". After I re-login, I see the same result, but I don't see the text "Net 60 Days" inside the filter TextBox.

2. The column reorder and sorting seem to work fine, but not for paging. How do I accomplish that?

Thank you,

Sompop

This is a profile section in my web.config.
    <profile enabled="true" defaultProvider="MyProfileProvider">
      <providers>
        <add name="MyProfileProvider" connectionStringName="myConnectionString" applicationName="/" type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
      <properties>
        <add name="GridAssetSettings" allowAnonymous="false" type="GridAssetSettings" serializeAs="Binary"/>  
</properties>
    </profile>

In .cs of the page where there is a RadGrid

protected override void Render(HtmlTextWriter writer)
{
  base.Render(writer);

  GridAssetSettings gas = new GridAssetSettings();
  gas.SaveGridAssetSettingsNames(RadGridSaveGridSettingsUserBase, "RadGridSaveGridSettingsUserBase");
  Context.Profile.SetPropertyValue("GridAssetSettings", gas);
}

protected void Page_Init(object sender, EventArgs e)
{
  if (Context.Profile.GetPropertyValue("GridAssetSettings") != null)
  {
    GridAssetSettings gas = (GridAssetSettings)Context.Profile.GetPropertyValue("GridAssetSettings");

    if (gas.Names.ContainsKey("RadGridSaveGridSettingsUserBase"))
      {
         GridSettings settings = new GridSettings(RadGridSaveGridSettingsUserBase);
         settings.LoadSettings(gas.Names["RadGridSaveGridSettingsUserBase"].ToString());
      }
    }
  }
}
Pavlina
Telerik team
 answered on 24 Oct 2011
3 answers
155 views
Hi,

I am using radUpload to upload multiple files at a time. I need to check file's size each time user selects a file. For that using "onclientfileselected="selectedFile" in radUpload control.

Below is the code in "selectedFile" javascript function.

  var inputs = sender.getFileInputs();
  size = inputs[i].files[0].fileSize;

But it shows "size" undefined.
Before some days, I was getting correct size, but now it is not working. I've not updated Telerik's version or anything like that. What could cause this kind of issue?

Please reply at the earliest as it is live on the site.
Peter Filipov
Telerik team
 answered on 23 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?