Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
96 views
Hello,
I am using RadSlidingPane in my web application. I have 4 RadSlidingPane vertically as shown in attachment. There are 4 tabs chart, navigator, document management and admin. My problem is that if I dock any one tab(for example chart) and click on other tab(for example navigator) then chart is shown in back as truncated. I want that is user click on navigator then chart should not be shown. How can I do this??
Dobromir
Telerik team
 answered on 16 May 2012
1 answer
117 views
I have written a code to add some files to database using grid. But I am unable to get the files in my code. This is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using Telerik.Web.UI;
using System.IO;
 
public partial class _Default : System.Web.UI.Page
{
    public DataTable table;
    public SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DoraConnectionString"].ConnectionString);
    SqlCommand command = new SqlCommand();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
 
        }
    }
    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        command.Connection = conn;
        string selectQuery = "Select * from Files";
        table = new DataTable();
 
        conn.Open();
        try
        {
            //Select Query to populate the RadGrid with data from table Employees.    
            sqlDataAdapter.SelectCommand = new SqlCommand(selectQuery, conn);
            sqlDataAdapter.Fill(table);
            RadGrid1.DataSource = table;
        }
        finally
        {
            //Close the SqlConnection    
            conn.Close();
        }
 
    }
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
         
        if (e.CommandName == RadGrid.PerformInsertCommandName)
        {
 
            RadUpload upload = (RadUpload)e.Item.FindControl("RadUpload1");
            foreach (UploadedFile f in upload.UploadedFiles)
            {
                f.SaveAs(Server.MapPath("./" + f.GetName()));
            }
            GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
 
            //string EmployeeID = (insertedItem["EmployeeID"].Controls[0] as TextBox).Text;  
 
            string FileName = (item["FileName"].FindControl("RadUpload1") as RadUpload).UploadedFiles[0].GetName();
            UploadedFile file = (item["FileName"].FindControl("RadUpload1") as RadUpload).UploadedFiles[0];
            int Size = (int)file.InputStream.Length;
            string ContentType = GetFileContentType(FileName);
            byte[] bytes = new byte[Size];
            file.InputStream.Read(bytes, 0, (int)file.InputStream.Length);
            DateTime Date = DateTime.Now;
 
            try
            {
                //Open the SqlConnection    
                conn.Open();
                //Update Query to insert into  the database     
                string insertQuery = "INSERT into  Files(FileName,FileData,Size,ContentType,Date) values(@FileName, @FileData,@Size, @ContentType, @Date)";
                command.CommandText = insertQuery;
                command.Connection = conn;
                command.Parameters.AddWithValue("@FileName", FileName);
                command.Parameters.AddWithValue("@FileData", bytes);
                command.Parameters.AddWithValue("@Size", Size);
                command.Parameters.AddWithValue("@ContentType", ContentType);
                command.Parameters.AddWithValue("@Date", Date);
                command.ExecuteNonQuery();
                //Close the SqlConnection    
                conn.Close();
 
 
            }
            catch (Exception ex)
            {
                RadGrid1.Controls.Add(new LiteralControl("Unable to insert Files. Reason: " + ex.Message));
                e.Canceled = true;
            }
        }
        if (e.CommandName == RadGrid.UpdateCommandName)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
 
            //string EmployeeID = (insertedItem["EmployeeID"].Controls[0] as TextBox).Text;  
 
            string FileName = (item["FileName"].FindControl("RadUpload1") as RadUpload).UploadedFiles[0].GetName();
            UploadedFile file = (item["FileName"].FindControl("RadUpload1") as RadUpload).UploadedFiles[0];
            int Size = (int)file.InputStream.Length;
            string ContentType = GetFileContentType(FileName);
            byte[] bytes = new byte[Size];
            file.InputStream.Read(bytes, 0, (int)file.InputStream.Length);
            DateTime Date = DateTime.Now;
 
            try
            {
                //Open the SqlConnection    
                conn.Open();
                //Update Query to insert into  the database     
                string insertQuery = "update Files set FileName=@FileName, FileData=@FileData, Size=@Size, ContentType=@ContentType, Date=@Date where ID=@ID";
                command.CommandText = insertQuery;
                command.Connection = conn;
                command.Parameters.AddWithValue("@FileName", FileName);
                command.Parameters.AddWithValue("@FileData", bytes);
                command.Parameters.AddWithValue("@Size", Size);
                command.Parameters.AddWithValue("@ContentType", ContentType);
                command.Parameters.AddWithValue("@Date", Date);
                command.Parameters.AddWithValue("@ID", item.GetDataKeyValue("ID"));
                command.ExecuteNonQuery();
                //Close the SqlConnection    
                conn.Close();
 
 
            }
            catch (Exception ex)
            {
                RadGrid1.Controls.Add(new LiteralControl("Unable to update Files. Reason: " + ex.Message));
                e.Canceled = true;
            }
        }
    }
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            LinkButton lnk = (e.Item as GridDataItem)["Preview"].Controls[0] as LinkButton;
            lnk.OnClientClick = "Preview(" + (e.Item as GridDataItem).GetDataKeyValue("ID") + "); return false;";
        }
    }
    private string GetFileContentType(string filename)
    {
        string contentType = string.Empty;
 
        int indexOfDot = filename.LastIndexOf(".");
 
        if (indexOfDot > 0)
        {
            ++indexOfDot;
 
            string ext = filename.Substring(indexOfDot, (filename.Length - indexOfDot));
 
            if (!string.IsNullOrEmpty(ext))
            {
                switch (ext.ToLower().Trim())
                {
                    case "doc":
                    case "docx":
                        contentType = "application/msword";
                        break;
 
                    case "pdf":
                        contentType = "application/pdf";
                        break;
 
                    case "xls":
                    case "xlsx":
                        contentType = "application/ms-excel";
                        break;
 
                    case "rar":
                        contentType = "application/winrar";
                        break;
                    case "txt":
                        contentType = "text/plain";
                        break;
                    case "gif":
                        contentType = "image/gif";
                        break;
                    case "jpeg":
                    case "jpg":
                        contentType = "image/jpeg";
                        break;
                    case "png":
                        contentType = "image/x-png";
                        break;
                    case "tif":
                        contentType = "image/tiff";
                        break;
                    case "bmp":
                        contentType = "image/x-ms-bmp";
                        break;
                    default:
                        contentType = "application/octet-stream";
                        break;
                }
            }
        }
        return contentType;
    }
}
Jayesh Goyani
Top achievements
Rank 2
 answered on 16 May 2012
1 answer
147 views
I have upgraded to version Q1 Feb 2012 and now I can't find the RadButton in the toolbox. It's also saying that there is an error when compiling because radbutton is an unknown server tag.I would like to know what to do in this case. I downgrade to 2011 version.
Slav
Telerik team
 answered on 16 May 2012
2 answers
96 views
I have some content initialized in RadAjaxPanel which gets changed if I click next/previous buttons inside that panel and content inside that panel gets changed on every button click. The problem is that if I hit browser's refresh button, content gets changed and go to first record which was initialized when page was loaded first time. How can we stop that browser's refresh effect on content inside RadAjaxPanel?
Maria Ilieva
Telerik team
 answered on 16 May 2012
8 answers
147 views

I was testing my own built RADScheduler page and I found a bug.
My page will always start an advanced form to insert, when I press the Enter key, the focus dissappeared.

In my masterpage I have a Log Out button. Every time when I press the Enter key, I get logged out. How can I get the focus on the advanced insert form?

In my advanced form I have one custom attribute.

This problem also happens with the demo RADScheduler page. I use Internet Explorer 9 to test it. 

I don't have any code in Javascript or in the CS file:

<telerik:RadScheduler AppointmentStyleMode="Default" Culture="nl-NL" EnableCustomAttributeEditing="True"
        DataDescriptionField="omschrijving" DataEndField="eindtijd" DataKeyField="OID"
        DataRecurrenceField="terugkeerRegel" DataRecurrenceParentKeyField="terugkeerOID"
        DataSourceID="ldeAgenda" DataStartField="starttijd" DataSubjectField="onderwerp"
        DayEndTime="19:00:00" DayStartTime="07:00:00" EditFormTimeFormat="H:mm" EnableDescriptionField="True"
        FirstDayOfWeek="Monday" Height="" HoursPanelTimeFormat="H:mm" ID="rsrAgenda"
        CustomAttributeNames="locatie" LastDayOfWeek="Sunday" OnFormCreated="Schedule_FormCreated"
        <%--OnAppointmentInsert="InsertAfspraak" OnAppointmentDelete="DeleteAfspraak" OnAppointmentUpdate="UpdateAfspraak"--%>
        runat="server" SelectedView="MonthView" StartInsertingInAdvancedForm="True" WorkDayEndTime="19:00:00"
        WorkDayStartTime="07:00:00">
        <AdvancedForm Modal="true" TimeFormat="H:mm" />
        <TimelineView GroupingDirection="Vertical" />
        <MonthView GroupingDirection="Horizontal"></MonthView>
        <DayView EnableExactTimeRendering="True" />
        <AppointmentContextMenuSettings EnableDefault="true" EnableEmbeddedSkins="True" />
        <AdvancedForm Modal="true" ZIndex="2000000" />
        <TimeSlotContextMenuSettings EnableEmbeddedSkins="True" />
        <TimeSlotContextMenus>
            <telerik:RadSchedulerContextMenu ID="SchedulerTimeSlotContextMenu" runat="server">
                <Items>
                    <telerik:RadMenuItem Text="Nieuwe Afspraak" Value="CommandAddAppointment" />
                    <telerik:RadMenuItem Text="Naar Vandaag" Value="CommandGoToToday" />
                    <telerik:RadMenuItem Text="Naar Herhaalafspraak" Value="CommandAddRecurringAppointment" />
                    <telerik:RadMenuItem Text="Geef 24 uur..." Value="CommandShow24Hours" />
                </Items>
            </telerik:RadSchedulerContextMenu>
        </TimeSlotContextMenus>
        <AppointmentContextMenus>
            <telerik:RadSchedulerContextMenu runat="server" ID="ContextMenu">
                <Items>
                    <telerik:RadMenuItem Text="Afspraak wijzigen" Value="CommandEdit" />
                    <telerik:RadMenuItem Text="Afspraak verwijderen" Value="CommandDelete" />
                </Items>
            </telerik:RadSchedulerContextMenu>
        </AppointmentContextMenus>
    </telerik:RadScheduler>
    <asp:LinqDataSource ID="ldeAgenda" runat="server" ContextTypeName="AGenda.AgendaDataContext"
        TableName="Agendas" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:LinqDataSource>

Plamen
Telerik team
 answered on 16 May 2012
1 answer
312 views
I think that there's been a problem with the Copy'n'Paste inheritance used to put together the man page for this property.

All of the content refers to the ClientSettings class rather than the DataBinding class you would expect.

I don't know if the man pages for this class and it's properties are missing or just inaccessible.

--
Stuart
Tsvetina
Telerik team
 answered on 16 May 2012
1 answer
112 views
I have used Hierarichal radgrid. In that  i have to display empty according to a condition.

Have used below code on page load event:
 if (PrimaryID > 0)
                    {
                        PopulateData();
                        //data will be populated
                        AttributeNameGridBind();
                      
                    }
                    else
                    {
                        this.rgdLabTest.MasterTableView.NoMasterRecordsText = Utility.ContentFetcher.GetResourceContent("RES_035", BOL.Classes.EHRSessions.Culture);
                    }

But grid is showing as solidline istead of no record to dispay message.
Can anyone suggest something.

I want the message from codebehind.
Shinu
Top achievements
Rank 2
 answered on 16 May 2012
6 answers
112 views
I'm using RadEditorMoss v 5.8.15 and I'm not finding a MediaManager.gif in the ToolImages folder.  Is this a sign that I installed the light version?  I have the Ajax pack so I should have access to the full thing right?
Dave
Top achievements
Rank 1
 answered on 16 May 2012
3 answers
98 views
Hi.
I create a panel bar item, and attach ItemTemplate to it in the code-behind.
Everything looks ok, controls added to panel bar display just fine, but when i try to access them in code-behind (after a button on page being clicked) RadPanelITem that contains dynamically added controls doesn't show them anymore, its Controls collection is empty (but it's not empty after i add the controls) and findControl returns null.
What am i doing wrong?
Dimitar Terziev
Telerik team
 answered on 16 May 2012
1 answer
58 views
Hi there,

I'm setting a data set as the data source to the rad grid view then, all the values are displayed but some problem is there means for the gird i i allowed AutoInsertColumns = TRUE and AutoEditColumns = TRUE

please see the diagram
Antonio Stoilkov
Telerik team
 answered on 16 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?