Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
183 views
I have a situation where a user uploads a file and we put that into a session variable and an imageeditor.
 protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            //Clear changes and remove uploaded image from Cache
          ImageEditor_CreateDonor.ResetChanges();
        //   Context.Cache.Remove(Session.SessionID + "UploadedFile");
            using (Stream stream = e.File.InputStream)
            {
                byte[] imgData = new byte[stream.Length];
                stream.Read(imgData, 0, imgData.Length);
                MemoryStream ms = new MemoryStream();
                ms.Write(imgData, 0, imgData.Length);

                Context.Cache.Insert(Session.SessionID + "UploadedFile", ms, null, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
            }
        }

Then we put it into a image editor.
 protected void ImageEditor_CreateDonor_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
        {
           
            //Handle Uploaded images
            if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
           {
                using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
                {
                    args.Image = image.Clone();
                    args.Cancel = true;
                }
           }
        }
We the image is cropped we save the crop into the session variable.
 protected void RadImgEdt_ImageChanging(object sender, ImageEditorEventArgs e)
        {
           
            Context.Cache.Remove(Session.SessionID + "UploadedFile");
            Context.Cache.Insert(Session.SessionID + "UploadedFile", e.Image, null, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
        }

Now once we save, we want to save in the db which is a byte[] format, it doesn't save correctly. (I will the comments in to show the various things I have tried.
protected void BtnDonorSave_Click(object sender, EventArgs e)
        {
            Boolean isLandingPage = false;
            string rtxtScholarshipName = this.txtScholarshipName.Text;
            string rtxtScholarshipDesc = this.txtScholarshipDesc.Text;
            byte[] fileData;


            MemoryStream file;
            EditableImage eImage;
            try
            {
                //UploadedFile file = AsyncUpload1.UploadedFiles[0];
                //fileData = new byte[file.InputStream.Length];
                //file.InputStream.Read(fileData, 0, fileData.Length);
              
                 file =
                     (MemoryStream) Context.Cache.Get(Session.SessionID + "UploadedFile");
                
                
               // UploadedFile file = AsyncUpload1.UploadedFiles[0];
               // var file = Context.Cache[(Session.SessionID + "UploadedFile")] as  MemoryStream;
                 fileData = new byte[file.Length];
                 file.Read(fileData, 0, fileData.Length);
            }

            catch (ArgumentOutOfRangeException e1)
            {
                Response.Write("<script>alert('Donor cannot be added without an image');</script>");
               
                return;
            }
       

            Int32 rcollegeId = Convert.ToInt32(this.collegeId.SelectedValue);
            string rtxtNotes = this.txtNotes.Text;
            if (chkBxNotes.Checked == true)
                isLandingPage = true;


            db.CreateDonor(rcollegeId, rtxtScholarshipName, rtxtScholarshipDesc, ReadFully(Context.Cache.Get(Session.SessionID + "UploadedFile") as MemoryStream), rtxtNotes, User.Identity.Name, DateTime.Now, isLandingPage.ToString()).Execute();
            //Response.Write("<script>alert('Donor Created');</script>");
            Session["CollDiv"] = collegeId.SelectedValue;
            Response.Redirect("DonorProfiles.aspx");
        }

So after save when I try to view the image it is a bad image.

Anyone know how to save a cropped image into a database from an imageeditor?

Thanks





Vessy
Telerik team
 answered on 19 May 2014
5 answers
139 views
Hi all,
I used Splitter Control to develop my Project. I have a problem below:
1/ When the Text is very long=> the scrollbar is shown
2/ We click on the scrollbar and drag down=> 2 splitter is drag too

I want to fix the position of the splitter.

Please view some images in attached file.


Please help me to solve it

Thanks alot 
Vessy
Telerik team
 answered on 19 May 2014
1 answer
87 views
Hi,
I need to show the fields name in my fields window with an alias. Is it possible?
My pivotgrid is populated with an object like this:

public class ReportModelObject
    {
        private string m_CompanyCode;
        private string m_CompanyDescription;
        private string m_CountryCode;
        private string m_CountryDescription;
        private string m_SiteCode;
        private string m_SiteDescription;
 
        public ReportModelObject()
        {
 
        }
 
        public string CompanyCode
        {
            get { return m_CompanyCode; }
            set { m_CompanyCode = value; NotifyPropertyChanged("CompanyCode"); }
        }
        public string CompanyDescription
        {
            get { return m_CompanyDescription; }
            set { m_CompanyDescription = value; NotifyPropertyChanged("CompanyDescription"); }
        }
        public string CountryCode
        {
            get { return m_CountryCode; }
            set { m_CountryCode = value; NotifyPropertyChanged("CountryCode"); }
        }
        public string CountryDescription
        {
            get { return m_CountryDescription; }
            set { m_CountryDescription = value; NotifyPropertyChanged("CountryDescription"); }
        }
        public string SiteCode
        {
            get { return m_SiteCode; }
            set { m_SiteCode = value; NotifyPropertyChanged("SiteCode"); }
        }
        public string SiteDescription
        {
            get { return m_SiteDescription; }
            set { m_SiteDescription = value; NotifyPropertyChanged("SiteDescription"); }
        }
         
        #region INotifyPropertyChanged Implementation
 
        [field: NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;
 
        protected void NotifyPropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(name));
        }
 
        #endregion
         
    }
Mattia
Top achievements
Rank 2
 answered on 19 May 2014
10 answers
1.1K+ views
 

How to get Radgrid dropdown list template column selected value  in InsertCommand?


I used below, doesn't work.  Also, how to make the text filter work for a dropdownlist column?

 

 

 

DropDownList dl;

 

 

dl = newItem[

 

"Language"].Controls[0] as DropDownList;

 

 

 

 

String SelectLanguageID = dl.SelectedValue;

 

 

 

----------------------------------------------------------------
<
telerik:GridTemplateColumn HeaderText="Language" UniqueName="Language" 

 

 

 

AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"

 

 

 

ShowFilterIcon="false" FilterControlWidth="200px" >

 

 

 

 

 

 

 

 

<EditItemTemplate> 

 

 

 

<asp:DropDownList ID="ddlLanguage" runat="server"> 

 

 

 

</asp:DropDownList> 

 

 

 

</EditItemTemplate> 

 

 

 

<FooterTemplate> 

 

 

 

<asp:Label ID="lblLanguage" runat="server">

 

 

 

 

 

</asp:Label> 

 

 

 

</FooterTemplate> 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

 

 

</telerik:GridTemplateColumn>


Thanks!

Eyup
Telerik team
 answered on 19 May 2014
0 answers
71 views
I use telerik pie chart and I create it on server (from DB):

        private void cViolationsPerTime_NeedDataSource(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;

            procChart.DataSource = BLL.BO.Audit.ExecuteAuditCommand(GenerateViolationsPerTimeSql(filters, "All"), type, conn, fromDate, toDate);

            Telerik.Reporting.Charting.ChartSeries csViolationsPerTime = new Telerik.Reporting.Charting.ChartSeries();
            csViolationsPerTime.DataYColumn = "NumOfViolations";
            csViolationsPerTime.Type = Telerik.Reporting.Charting.ChartSeriesType.Pie;
            csViolationsPerTime.DataLabelsColumn = "timeslot";

            csViolationsPerTime.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
            csViolationsPerTime.Appearance.ShowLabelConnectors = true;
            csViolationsPerTime.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Calibri", 7F);

            cViolationsPerTime.Series.Clear();
            cViolationsPerTime.Series.Add(csViolationsPerTime);

        }


Attached screen shot with the result I get.
I want to get different legend then the data labels.
How can I bind a different column to the legend?

This is my SQL result:
timeslot     numOfViolations
10:00-12:00      40
12:00-14:00      10
14:00-16:00      8

etc...

I want each part of the pie to display the number of violations, and in legend I want to see the time slot.       


Covertix
Top achievements
Rank 1
 asked on 19 May 2014
3 answers
330 views
I have a rad splitter, inside that i have two RadPanes named as "rLeftPane" and "rContentPane".

In "rLeftPane" RadPane (ie. LEFT RadPane) I am loading an ASP.NET usercontrol which behaves as a menu, the usercontrol basically, is nothing but a RadWindow.

Now inside the "rContentPane" RadPane(ie. RIGHT RadPane) I am having another RadWindow named as "rwMain", which is used to load the aspx pages (combination of master page and content page), which is loaded in AJAX call and does not postback's the page.

Now what I want is, this, staying inside the "rContentPane" RadPane's (ie. RIGHT RadPane) RadWindow, at page loading, I want to access a control's present inside RadWindow which is in "rLeftPane" RadPane(ie. LEFT RadPane).

Here is the code :

<telerik:RadSplitter ID="Splitter" runat="server" Width="100%" Height="100%" VisibleDuringInit="false"
            Skin="Office2007" OnClientResizing="Resizing">

            <telerik:RadPane ID="rLeftPane" runat="server" Width="200" MinWidth="200" MaxWidth="200"
                OnClientCollapsed="WindowShow" OnClientExpanded="WindowShow" BackColor="DarkGray">

                <ERPx:LeftMainMenu ID="ucLeftMainMenu" runat="server" /> // This is my UserControl

            </telerik:RadPane>

            <telerik:RadSplitBar ID="VerticalSplitBar" runat="server" CollapseMode="Forward" EnableResize="false" />

            <telerik:RadPane ID="rContentPane" runat="server">

                <telerik:RadWindow ID="rwMain" runat="server" VisibleOnPageLoad="true" ShowContentDuringLoad="false"
                    OnClientShow="WindowShow" VisibleStatusbar="False" Behaviors="None" EnableShadow="false" OnClientBeforeClose="OnClientBeforeClose1" OnClientPageLoad="WindowLoad" IconUrl="images/18_users.gif" Skin="Office2007">
                </telerik:RadWindow>

            </telerik:RadPane>
        </telerik:RadSplitter>

Please help me out.

Thanks.
Vessy
Telerik team
 answered on 19 May 2014
3 answers
149 views
Hi All,

I'm using telerik 2013 Q3 for development. Now I want to implement a page that contains a radgrid, and the radgrid can expand to expand a DetailTables. The DetailTables has just one column GridTemplateColumn and in its ItemTemplate contains a RadTreeList.
My question is after click expand button, I cannot get RadTreeList instance whatever from dataBound, ItemCreated or anyother events. So how can I set datasource to the RadTreeList in DetailTables ItemTemplate.

Can anyone help on this, please? Thanks.
Eyup
Telerik team
 answered on 19 May 2014
1 answer
126 views
ello I've got some problem wih the paging of Telerik RadGrid Control! When it's first page - there is no problem it loads me three rows as I have givenpageSize property value - "3". But when I try to get to the second page - it gives me an error:

39e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404


Here is my aspx file

<
telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowCustomPaging="false" AllowPaging="True" PageSize="3" OnPageIndexChanged="RadGrid2PageIndexChanged" OnNeedDataSource="radGridOnNeedDataSource" ><br>                          <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" PageSizeControlType="RadComboBox"></PagerStyle><br>                             <MasterTableView><br>                                <Columns><br>                                      <telerik:GridBoundColumn DataField="ArticlegroupID" HeaderText="ArticleGrouipID" UniqueName="groupID">                           <br>                                      </telerik:GridBoundColumn><br><br>                                       <telerik:GridBoundColumn DataField="SpecialWord" HeaderText="ProductDescription" UniqueName="ProductDescr" ><br>                                       </telerik:GridBoundColumn>  <br>                                       <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="ImageFile"<br>                                            AlternateText="Customer image" <br>                                            ImageAlign="Middle" ImageHeight="100px" ImageWidth="82px" HeaderText="Image Column"><br>                                       </telerik:GridImageColumn>   <br>                                </Columns><br>                             </MasterTableView><br><br><br><br>                      </telerik:RadGrid>

And here is my cs File with only one function in which I get the data for datasource from a web service and bind it to the radGrid:

 protected void radGridOnNeedDataSource(object source, GridNeedDataSourceEventArgs e)    
{  RadGrid p_RadIconProducts =
this.FindControl("RadGrid1") as RadGrid;            
   List<WebServiceBeaMenu> radTileIcon =
new List<WebServiceBeaMenu>();
   
 radTileIcon = MvcBeaDAL.WebServiceBea.GetArticle(p_menuID, p_articlegroupID, 1).ToList();            p_RadIconProducts.DataSource = radTileIcon;<br>           
   p_RadIconProducts.MasterTableView.VirtualItemCount = radTileIcon.Count;<br>            p_RadIconProducts.CurrentPageIndex = p_RadIconProducts.MasterTableView.CurrentPageIndex;<br><br><br>        }
Viktor Tachev
Telerik team
 answered on 19 May 2014
1 answer
126 views
Sir, I have a grid , its containing template columns and bounded columns,
  Onclientclicked event of a check box column , i do all checkbox expect the current cell are set  false.
this code is working correctely 
, but i also need  another bounded columns values are displayed, thats colums are visible is false.

please help me.
very urgent.

by , seban
 
Princy
Top achievements
Rank 2
 answered on 19 May 2014
1 answer
151 views
All,

I have table which is build in .net, dynamically (server side), which shows me an overview of all people that need to work on a specific day for a specific area.

A list is fine, but I would like to visualize this for users. I have multiple working area's and up to 20 people working per working area per day, so putting it all into an outlook style calender overview is useless as it will become to complicated.

I now had the idea to add a HR per entry (tr) which would correspond to the hours they need to work. (some like a range bar)

Attached the screenshot where i added the green lines in paint, to show what i'm trying to achieve. (The table is in Dutch but you can easily see what the working hours are)

Is there any telerik control that would offer this functionality?

Shinu
Top achievements
Rank 2
 answered on 19 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?