Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
72 views
Currently my schedular is readonly and only the date in the corner is clickable. How do I make the actual event clickable.
Also is there a way to make the entire square clickable as well?

Thanks
Peter
Telerik team
 answered on 18 Mar 2011
5 answers
287 views
Hi Telerik,

I'm using RadFileExplorer in this page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server">
            <Configuration UploadPaths="/Uploads/examples" ViewPaths="/Uploads/examples" DeletePaths="/Uploads/examples"
                MaxUploadFileSize="2097151000"
                SearchPatterns=".jpg" />
        </telerik:RadFileExplorer>
    </div>
    </form>
</body>
</html>

I set SearchPatterns: ".jpg" or "jpg" but I couldn't upload that file with extension "jpg", Please help me
Dobromir
Telerik team
 answered on 18 Mar 2011
5 answers
318 views
Hello,

Refrering to my unanswered thread
http://www.telerik.com/community/forums/aspnet-ajax/compression/radhiddenfieldpagestatecompression-gzip.aspx

and now porting to .net 4.

Being unsure that I am obtaining compressed Viewstate (they are so big), I want to trace on server the fact that the that it is compressed, Fiddler or FireBug can't be used easilly on a production site.


Is there a way to activate some server side trace in Telerik tools or to trace thta Viewstate is going through my .browser file and the control adapter is effectivelly usefd.

Thanks
CS
Simon
Telerik team
 answered on 18 Mar 2011
4 answers
470 views
Outside of the scheduler, I'm trying to loop through all events in a given date range.  Due to the complexity of recurrence, I have a hidden instance of the RadScheduler on my form, and I am looping through the appointments and resources examining each appointment to see if it falls within range.  The process is not smooth.  I'm having lots of trouble with recurrence.  For example, if I select one date, I'm getting two copies of the same event...one with, say, an ID of 105, and the other with an ID of 105_0.  If I select a week, I am only seeing the 105_0 appointment.

I am finding work-arounds for each issue as I encounter one, but do not have faith that there aren't other hidden problems. Is there a better way to loop through by date range?  The code below is just my latest experimentation. I probably need to scrap and start over.

private void LoopEvents()
{
    RadListBox rlbResources = PanelBar.Items[0].Items[0].FindControl("rlbResources") as RadListBox;
    DataTable dt;
    string canceled = "Canceled";
 
    string sql = "SELECT * FROM AppointmentResource";
    string errString = "";
    DateTime currdt = Convert.ToDateTime("1/1/1901");
 
    dt = PageData.GetData(sql, ref errString).Tables[0];
    if (rlbResources.Items.Count == 0)
        rlbResources.DataBind();
 
    foreach (Telerik.Web.UI.RadDate rd in RadCalendar1.SelectedDates)
    {
        foreach (Telerik.Web.UI.Appointment a in RadScheduler1.Appointments)
        {
                foreach (Telerik.Web.UI.RadListBoxItem l in rlbResources.Items)
                {
                    if (l.Checked & a.Resources.GetResource("Resource", Convert.ToInt32(l.Value)) != null)
                    {
                         
                        //Occurrences of a recurrence master are not generated untill they
                        //are within RadScheduler's visible range. This mandates the occurrences
                        //information to be extracted from the Master's recurrence rule as follows:
                        if ((a.RecurrenceState == RecurrenceState.Master) & RadCalendar1.SelectedDates.Count > 1)
                        {
                            RecurrenceRule parsedRule;
                            RecurrenceRule.TryParse(a.RecurrenceRule.ToString(), out parsedRule);
 
                            //If a recurring appointment does not have specified end time it will have
                            //endless occurrences. In this case you can explicitly put a restriction:
 
                            if (RadCalendar1.SelectedDates.Count > 1)
                                parsedRule.SetEffectiveRange(RadCalendar1.SelectedDates[0].Date, RadCalendar1.SelectedDates[RadCalendar1.SelectedDates.Count - 1].Date);
                            else
                                parsedRule.SetEffectiveRange(RadCalendar1.SelectedDate.AddDays(-1), RadCalendar1.SelectedDate.AddDays(1));
                             
                            foreach (DateTime occurrence in parsedRule.Occurrences)
                            {
                                if (occurrence.ToShortDateString() == rd.Date.ToShortDateString())
                                {
                                        //We have a match
                                }
                            }
                        }
                        else //Get the rest of the appointments    
 
                            //If the SelectedDate of RadScheduler is set so that the visible range encompasses occurences of     
                            //a recurring appointement, these occurences will be generated now so they will be added once again    
                            //to the DataTable. To prevent this, we use the following check:    
                            //if (a.RecurrenceState != RecurrenceState.Occurrence)
                            //{
                            if (WithinDate(a.Start, a.End, rd.Date))
                            {
                                  //We have a match
                            }
                        //}
 
                    }
                }
        }
    }
 
}
Peter
Telerik team
 answered on 18 Mar 2011
2 answers
74 views
I'm trying to bind a rad grid from a custom datatable but I cannot get any of the data to show. I have read all your examples but still cannot seem to get it to work. Here's my code
<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True"
GridLines="None" ShowGroupPanel="True" AutoGenerateColumns="False" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top">
        <Columns>
            <telerik:gridboundcolumn datafield="FirstName" headertext="First Name"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="LastName" headertext="Last Name"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Business Name" headertext="Business Name"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="State" headertext="State"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Zip" headertext="Zip"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Address" headertext="Address"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="City" headertext="City"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Phone" headertext="Phone"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Fax" headertext="Fax"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="CellPhone" headertext="Cell"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Eamil" headertext="Email"
            </telerik:gridboundcolumn>
            <telerik:gridboundcolumn datafield="Edit" headertext="Edit"
            </telerik:gridboundcolumn>
        </Columns>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="True">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
</telerik:RadGrid>

VB
'this function gets the data for the rad grid
Private Function getData()
    Dim table As DataTable = New DataTable()
    table.Columns.Add("First Name")
    table.Columns.Add("Last Name")
    table.Columns.Add("Business Name")
    table.Columns.Add("State")
    table.Columns.Add("Zip")
    table.Columns.Add("Address")
    table.Columns.Add("City")
    table.Columns.Add("Phone")
    table.Columns.Add("Fax")
    table.Columns.Add("Email")
    table.Columns.Add("CellPhone")
    table.Columns.Add("Edit")
    'my sql connection
    Dim myConn As New Data.SqlClient.SqlConnection(conn)
 
    'the name of the stored procedure
    Dim strSQL = "getAllCustomers"
 
    'add the initial - Please Select -
    'table.Rows.Add(New String() {"-1", "- Please Select -"})
 
    Try
 
        myConn.Open()
        Dim readCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)
 
        'while we have rows from the stored procedure
        'we will add them to a data table
        Dim cdr As SqlDataReader = readCommand.ExecuteReader()
        While cdr.Read()
 
            If (cdr.Item(0).ToString <> "") Then
 
                table.Rows.Add(New String() {cdr.Item(1), cdr.Item(2), cdr.Item(3), cdr.Item(4), cdr.Item(5), cdr.Item(6), cdr.Item(7), cdr.Item(8), cdr.Item(9), cdr.Item(10), cdr.Item("<a href='EditCustomer.aspx?id=" & cdr.Item(0) & "'>Edit</a>")})
 
            End If
 
        End While 'while cdr.Read()
 
    Catch ex As Exception
 
    End Try
    myConn.Close()
 
    Return table
 
End Function 'createTable
 
 
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
    RadGrid1.DataSource = getData()
End Sub

Web Services
Top achievements
Rank 2
 answered on 18 Mar 2011
1 answer
94 views
I am using the file explorer to manage images inside of a folder, much like the demo application, with file preview. There are no sub-folders. 

My folder that contain images are named after the record id. This is not a good name for the top level folder for the customer to see. I would like for the root folder to always read "Images". Is it possible to have the root folder named something other than what is actually on the server, for the GUI portion only?

Thanks. 
Dobromir
Telerik team
 answered on 18 Mar 2011
7 answers
191 views
We noticed the following issue with IE9 RC.

When a RadGrid is in a table and with UseStaticHeaders set to true the rows are not displayed at all.

<table style="width:100%">
    <tr>
        <td>
            <telerik:RadGrid ID="grd" runat="server" Skin="Windows7" Width="100%" Height="120px"
                AutoGenerateColumns="false">
                <MasterTableView Width="100%" TableLayout="Fixed">
                    <Columns>
                        <telerik:GridTemplateColumn>
                            <HeaderStyle Width="50%" />
                            <HeaderTemplate>
                                <asp:Label ID="lblNameHeader" runat="server" Text="Name"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblName" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn>
                            <HeaderStyle Width="50%" />
                            <HeaderTemplate>
                                <asp:Label ID="lblSurnameHeader" runat="server" Text="Surname"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblSurname" runat="server" Text='<%#Eval("Surname")%>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" />
                    <Scrolling ScrollHeight="120px" AllowScroll="true" UseStaticHeaders="true" />
                </ClientSettings>
            </telerik:RadGrid>
        </td>
    </tr>
</table>


Code Behind:
public partial class GridTest : System.Web.UI.Page
   {
       List<MyClass> lst = new List<MyClass>();
 
       protected void Page_Load(object sender, EventArgs e)
       {
           this.lst.Add(new MyClass("Andrew", "Dimech"));
           this.lst.Add(new MyClass("Rachel", "Smith"));
           this.lst.Add(new MyClass("James", "Black"));
 
           this.grd.DataSource = this.lst;
           this.grd.DataBind();
       }
   }
 
   public class MyClass
   {
       public MyClass(string name, string surname)
       {
           this.Name = name;
           this.Surname = surname;
       }
 
       private string name;
 
       public string Name
       {
           get { return name; }
           set { name = value; }
       }
 
       private string surname;
 
       public string Surname
       {
           get { return surname; }
           set { surname = value; }
       }
 
   }
Tsvetoslav
Telerik team
 answered on 18 Mar 2011
0 answers
186 views

Hi,

i have a grid with hyperlink column and which open the download.aspx page and file.
 <telerik:GridHyperLinkColumn
                                            DataNavigateUrlFields="FilePath" 
                                            DataTextField="FileName" 
                                            DataNavigateUrlFormatString="{0}" 
                                            Visible="true"
                                            HeaderText="File Name"
                                            Target="_blank"
                                            HeaderStyle-Width="300px"
                                        >
                                        </telerik:GridHyperLinkColumn>

now here "FilePath"  field is coming from db which is as follow...Test&Doc
but the querystring passing to downlaod.aspx page is only Test
i cannot able to do HttpUtility.UrlEncode as it is not supported.

if i write the column as  DataNavigateUrlFields=HttpUtility.UrlEncode("FilePath")

it gives error and not working,....


please help.


bharat kumar
Top achievements
Rank 1
 asked on 18 Mar 2011
2 answers
165 views
Hello,
        I am using RadUpload control with my application.

       When i select the File after browsing through my PC, when i click on Button.
        - I want the full path in which drive the file is being located. I have used the code as below :

         
MailMessage objmail = new MailMessage(); 
 
          if (RadUpload1.UploadedFiles.Count > 0) 
            { 
                foreach (UploadedFile file in RadUpload1.UploadedFiles) 
                { 
                    string strPath = string.Empty; 
                    strPath = file.FileName; 
                    System.Net.Mail.Attachment objattachment = new System.Net.Mail.Attachment(strPath); 
                    objmail.Attachments.Add(objattachment); 
                } 
            } 

  Now, when i RUN the page & DEBUG using FireFox,
        I get the strPath = "SubModule.txt"
      and get the error,
{System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\SubModule.txt'. 
File name: 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\SubModule.txt' 
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) 
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 
   at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName, String mediaType) 
   at System.Net.Mail.Attachment..ctor(String fileName) 
   at User_SendDocMail.btnsendmail_Click(Object sender, EventArgs e) in e:\Projects\ISalesPro\ISalesProWeb\User\SendDocMail.aspx.cs:line 53} 
 

But, When i Run with IE,
         I get the strPath = "C:\Documents and Settings\OM\Desktop\SubModule.txt"     
which works perfectly alright.


Please help me to sort out this Error in Firefox.

Thanks,
Kunal Govani
 

Genady Sergeev
Telerik team
 answered on 18 Mar 2011
2 answers
71 views
I have a rad grid that I have set the AllowAutomaticDeletes, Updates, and Inserts to False. This in the MsterTableView has a DetailTable.  So it is Hierarchy gid.  The top level works fine when I Insert or Update the grid comes out of editmode, and when I edit the DetailTable grid it will leave edit mode with no issue.  The problem is when I insert a new record in the DetailTable on save it stays in edit mode.  The data is saveed becuase when I hit the cancel button it shows the new record under the parent.

I'm I missing something

<telerik:RadGrid ID="rgSoftware" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="false"
        AllowSorting="false" GridLines="Both" AllowPaging="false" EnableViewState="true" Skin="WebBlue" 
        ShowHeader="true" EnableAJAXLoadingTemplate="True" LoadingTemplateTransparency="50" ShowStatusBar="True" 
        AllowAutomaticDeletes="false" AllowAutomaticUpdates="False" AllowAutomaticInserts="False"        
        OnNeedDataSource="rgSoftware_NeedDataSource" OnInsertCommand="rgSoftware_InsertCommand" OnUpdateCommand="rgSoftware_UpdateCommand"
        OnDetailTableDataBind="rgSoftware_DetailTableDataBind" OnItemCommand="rgSoftware_ItemCommand" OnDataBound="rgSoftware_DataBound">
        <MasterTableView Font-Names="Helvetica, Arial, Verdana, sans-serif" Font-Size="10px"
            DataKeyNames="SoftwareID" Name="SoftwareGroup" Width="100%" runat="server" EditMode="InPlace"
            CommandItemDisplay="Top">
            <DetailTables>
                <telerik:GridTableView DataKeyNames="LicenseInfoID" Name="LicenseInfoID" Width="100%"
                    runat="server" Font-Size="10px" EditMode="InPlace" CommandItemDisplay="Top" AllowAutomaticInserts="true"
                    AllowAutomaticUpdates="true">
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UpdateImageUrl="~/Images/Grid/Save.gif"
                            EditImageUrl="~/Images/Grid/Edit.gif" InsertImageUrl="~/Images/Grid/Save.gif"
                            CancelImageUrl="~/Images/Grid/Cancel.gif" />
                        <telerik:GridBoundColumn DataField="LicenseInfoID" Visible="false" />
                        <telerik:GridTemplateColumn HeaderText="Key" UniqueName="Key">
                            <ItemTemplate>
                                <asp:Label ID="lblKey" runat="server" Text='<%# Eval("LicenseKey")%>' />
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="tbKey" runat="server" Text='<%# Eval("LicenseKey")%>' Width="200px"
                                    Font-Size="10px" />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="# of Licenses" UniqueName="Qty">
                            <ItemTemplate>
                                <asp:Label ID="lblQty" runat="server" Text='<%# Eval("NumberOfLicenses")%>' />
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox ID="tbQty" runat="server" text='<%# Eval("NumberOfLicenses")%>'
                                    Width="30px" NumberFormat-DecimalDigits="0" ShowSpinButtons="false" Font-Size="10px" />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridCheckBoxColumn UniqueName="chkActive" DataField="Active" HeaderText="Active" />
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UpdateImageUrl="~/Images/Grid/Save.gif"
                    EditImageUrl="~/Images/Grid/Edit.gif" InsertImageUrl="~/Images/Grid/Save.gif"
                    CancelImageUrl="~/Images/Grid/Cancel.gif" />
                <telerik:GridBoundColumn DataField="SoftwareID" Visible="false" />
                <telerik:GridTemplateColumn HeaderText="Software" UniqueName="SoftwareName">
                    <ItemTemplate>
                        <asp:Label ID="lblSoftwareName" runat="server" Text='<%# Eval("SoftwareName")%>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox ID="tbSoftwareName" runat="server" Text='<%# Eval("SoftwareName")%>'
                            Width="250px" Font-Size="10px" />                        
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Location" UniqueName="LocationOfSoftware">
                    <ItemTemplate>
                        <asp:Label ID="lblLocationOfSoftware" runat="server" Text='<%# Eval("LocationOfSoftware")%>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox ID="tbLocationOfSoftware" runat="server" Text='<%# Eval("LocationOfSoftware")%>'
                            Width="250px" Font-Size="10px" />                        
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridCheckBoxColumn HeaderText="Active" DataField="Active" UniqueName="SoftwareActive" />
            </Columns>
        </MasterTableView>
        <ClientSettings AllowRowsDragDrop="true">
        </ClientSettings>
        <FilterMenu EnableEmbeddedSkins="False">
        </FilterMenu>
    </telerik:RadGrid>




protected void rgSoftware_InsertCommand(object source, GridCommandEventArgs e)
       {
           AssetDataDataContext db = new AssetDataDataContext();
           GridEditableItem editedItem = e.Item as GridEditableItem;
           if ("SoftwareGroup".Equals(e.Item.OwnerTableView.Name))
           {                
               Software nSoftware = new Software();
               SaveSoftwareGroup(nSoftware, editedItem);
               db.Softwares.InsertOnSubmit(nSoftware);                
           }
           else if ("LicenseInfoID".Equals(e.Item.OwnerTableView.Name))
           {
               GridDataItem parentItem = (GridDataItem)e.Item.OwnerTableView.ParentItem;
               LicenseInfo nLicense = new LicenseInfo();
                              
               nLicense.SoftwareID = Int32.Parse(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["SoftwareID"].ToString());
               SaveLicenseInfo(nLicense, editedItem);                
               db.LicenseInfos.InsertOnSubmit(nLicense);
           }
           db.SubmitChanges();
             
       }
       protected void rgSoftware_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
           AssetDataDataContext db = new AssetDataDataContext();
           GridEditableItem editedItem = e.Item as GridEditableItem;
           if ("SoftwareGroup".Equals(e.Item.OwnerTableView.Name))
           {                
               Int32 SoftwareID = Int32.Parse(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["SoftwareID"].ToString());                
               Software nSoftware = db.Softwares.SingleOrDefault(s => s.SoftwareID == SoftwareID);
               SaveSoftwareGroup(nSoftware, editedItem);
           }
           else if ("LicenseInfoID".Equals(e.Item.OwnerTableView.Name))
           {
               //Get the primary key value using the DataKeyValue.     
               Int32 LicenseInfoID = Int32.Parse(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["LicenseInfoID"].ToString());
               LicenseInfo nLicense = db.LicenseInfos.SingleOrDefault(l => l.LicenseInfoID == LicenseInfoID);
               SaveLicenseInfo(nLicense, editedItem);   
           }
           db.SubmitChanges();
           rgSoftware.MasterTableView.ClearEditItems();
       }
Eric Klein
Top achievements
Rank 1
 answered on 18 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?