Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
594 views
We are using a asp:PlaceHolder control that we inject (add) a code generated grid to, which then is used to output the excel report.
I have a method that creates the grid, and wires up several events...
I am trying to figure out how to wire up the event ExportCellFormatting...

protected void grid_ExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)
        {
            // Set all cells to string to include leading zeros.
            e.Cell.Style["mso-number-format"] = @"\@";
        }

but it just does not like what i have done so far.. 


The error I get is 
Error	2	No overload for 'grid_ExportCellFormatting' matches delegate 'System.EventHandler<Telerik.Web.UI.ExportCellFormattingEventArgs>'	C:\TFS 2008\TIPWeb Scrum\Dev\TIPWebITApp\TIPWebIT\TagManagement\Tags.aspx.cs	650	46	TIPWebIT
protected void CreateGrid()
       {
           using (RadGrid grid = new RadGrid())
           {
               grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);
               grid.ExcelMLExportRowCreated += new GridExcelMLExportRowCreatedEventHandler(grid_ExcelMLExportRowCreated);
               grid.ExcelMLExportStylesCreated += new GridExcelMLExportStylesCreatedEventHandler(grid_ExcelMLExportStylesCreated);
 // HERE IS MY PROBLEM -------- Remember I do not have the grid on the actual aspx page, it is inserted into the place holder tag...
               grid.ExportCellFormatting += new EventHandler<ExportCellFormattingEventArgs>(grid_ExportCellFormatting);
 // END OF MY PROBLEM ---------
               grid.EnableLinqExpressions = false;
               grid.AllowFilteringByColumn = true;
 
               grid.ID = "RadGrid1";
               grid.ExportSettings.ExportOnlyData = true;
               grid.ExportSettings.IgnorePaging = true;
               grid.ExportSettings.OpenInNewWindow = true;
 
               switch (reportName)
               {
                   case ReportName.PrintTagReport:
                       grid.ExportSettings.FileName = "TagListing";
                       break;
               }
 
               grid.AllowSorting = true;
               PlaceHolder1.Controls.Add(grid);
               grid.MasterTableView.ExportToExcel();
           }
       }
Kostadin
Telerik team
 answered on 15 Apr 2016
5 answers
116 views

I i need to be able to access the text boxes within my form popup on rad grid I have tried the usual find controls but to no avail it always returns null. I cannot do it in itemDatabound as I am using a function in my dal which I need to pass the raw value to.

 

01.<telerik:RadGrid ID="rgNotes" runat="server" GroupPanelPosition="Top" OnItemCommand="rgNotes_ItemCommand"  >
02.                                   <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
03.                                   <MasterTableView NoDetailRecordsText="No notes for this Appointment" AutoGenerateColumns="False" DataKeyNames="notes_id" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add Notes" AllowAutomaticInserts="true" EditMode="PopUp">
04.                                       <Columns>
05.                                           <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
06.                                           </telerik:GridEditCommandColumn>
07.                                           <telerik:GridBoundColumn DataField="notes_id" FilterControlAltText="Filter notes_id column" HeaderText="notes_id" ReadOnly="True" SortExpression="notes_id" Visible="true" UniqueName="notes_id">
08.                                           </telerik:GridBoundColumn>
09.                                           <telerik:GridBoundColumn DataField="Subject" FilterControlAltText="Filter Subject column" HeaderText="Subject" ReadOnly="True" SortExpression="Subject" UniqueName="Subject">
10.                                           </telerik:GridBoundColumn>
11.                                       </Columns>
12. 
13.                                       <EditFormSettings EditFormType="Template" InsertCaption="Add new Note" CaptionFormatString="Please enter or update note">
14.                                           <FormTemplate>
15. 
16.                                               <telerik:RadTextBox ID="txtNotesId" Visible="false" Width="200px" runat="server"></telerik:RadTextBox>
17. 
18.                                               Subject
19.                                               <p>
20.                                                   <telerik:RadTextBox ID="txtSubjectNotes" Width="200px" runat="server"></telerik:RadTextBox>
21.                                               </p>
22.                                               <p>
23.                                                   Notes<br />
24.                                                   <telerik:RadTextBox ID="RadTextBox1" TextMode="MultiLine" Rows="10" Columns="10" Width="200px" runat="server"></telerik:RadTextBox>
25.                                               </p>
26. 
27.                                               <telerik:RadButton ID="rdSaveNotes" OnClick="rdSaveNotes_Click" Skin="Bootstrap" BackColor="#512479" ForeColor="White" runat="server" Text="Save Notes"></telerik:RadButton>
28.                                               <telerik:RadButton ID="rdCancel" OnClick="rdCancel_Click1" CommandName="Cancel" Skin="Bootstrap" BackColor="#512479" ForeColor="White" runat="server" Text="Cancel"></telerik:RadButton>
29.                                           </FormTemplate>
30.                                       </EditFormSettings>
31.                                   </MasterTableView>
32.                                   <ClientSettings>
33.                                       <ClientEvents OnPopUpShowing="PopUpShowing" />
34.                                       <Selecting AllowRowSelect="true" />
35.                                   </ClientSettings>
36.                               </telerik:RadGrid>

01.protected void rdSaveNotes_Click(object sender, EventArgs e)
02.{
03.    try
04.    {
05.        int id = Convert.ToInt32(Request.QueryString["id"]);
06.        tblApertureNetNote _note = new tblApertureNetNote();
07. 
08.        _note = _dal.GetNotesById(new Guid(notes_id),_myuser.UserId);
09. 
10.        _note.appointment_id = id;
11.        _note.authUserId = _myuser.UserId;
12.        _note.isActive = true;
13.        _note.isDeleted = false;
14.        _note.subject = txtSubject.Text;
15.        if (_note.EntityState == System.Data.EntityState.Detached)
16.            _dal.Addnotes(_note);
17. 
18.        rgNotes.DataBind();
19.    }
20.    catch (Exception ex)
21.    {
22.        logger.Error("Error in rdSaveNotes_Click function calandar edit.aspx" + ex.ToString());
23.    }
24.}

 

It is txtSubjectNotes.Text i require to access and Notes textbox Please can you advise also how can i close the popup from this button. Many thanks.

Viktor Tachev
Telerik team
 answered on 15 Apr 2016
1 answer
227 views

 

This is really minor, but in the example below, I get Visual Studio warnings that both Calendar and DateInput don't have runat="server". In looking online, I've seen examples where they exist and don't exist, so I'm assuming it doesn't matter. If that's the case, I'll add runat="server" to cut down on all my warnings, but I wanted to double check in case there's any reason not to include runat="server".

 

<telerik:RadDatePicker ID="rdpBatchDate" runat="server" TabIndex="4" Culture="English (United States)">
    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x" ShowRowHeaders="false">
        <SpecialDays>
            <telerik:RadCalendarDay Repeatable="Today" ItemStyle-BorderColor="Blue">
            </telerik:RadCalendarDay>
        </SpecialDays>
    </Calendar>
    <DatePopupButton HoverImageUrl="" ImageUrl="" TabIndex="-1" ToolTip="Calendar Search" />
    <DateInput DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" TabIndex="2">
    </DateInput>
</telerik:RadDatePicker>

 

 

 

Kostadin
Telerik team
 answered on 15 Apr 2016
3 answers
198 views

Hello,

I'm working on mapping column data to RadHTMLChart control & I'm running into a label display issue. One of the column colors that is used by my graph is black & it makes the tooltip label difficult to read since it also defaults to black. Is there a way to determine what color the column will be when the color for the column is set dynamically so that I can update the black column's tooltip label color? 

Thanks,

Johnathan Beam

Danail Vasilev
Telerik team
 answered on 15 Apr 2016
1 answer
37 views

Hello,

I am creating a pie chart with three items

Responded/ Responded with comments/ Not responded

                 DataTable dt = GetDataTable();

                PieSeries chartData = new PieSeries();
                PieChart1.ChartTitle.Text = "Title";
                chartData.StartAngle = 90;
                chartData.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieAndDonutLabelsPosition.Center;

                SeriesItem item = new SeriesItem();
                SeriesItem item1 = new SeriesItem();
                SeriesItem item2 = new SeriesItem();

                foreach (DataRow row in dt.Rows)
                {

                    if (row["Responded"] != null && Convert.ToBoolean(row["Responded"]))
                    {
                        i++;
                    }

                    else if (row["Respondedwithcomments"] != null && Convert.ToBoolean(row["Respondedwithcomments"]))
                    {
                        j++;
                    }

                    else if(row["Responded"] == null)
                    {
                        k++;
                    }
                }

                chartData.LabelsAppearance.DataFormatString = "{0}";
                chartData.TooltipsAppearance.DataFormatString = "{0} ";
               
                
                item.Name = "Responded"; 

                item.YValue = i;

                item.BackgroundColor = System.Drawing.Color.YellowGreen;

             
                item1.Name = "Responded with comments";              
                item1.YValue = j;               
                item1.BackgroundColor = System.Drawing.Color.PaleVioletRed;
                

                item2.Name = "Not Responded";               
                item2.YValue = k;            
                item2.BackgroundColor = System.Drawing.Color.LightYellow;


              chartData.Items.Add(item);
                chartData.Items.Add(item1);
                chartData.Items.Add(item2);
               
              

                PieChart1.PlotArea.Series.Add(chartData);

 

Each time the chart refreshes to get the new data , the series name adds up so and I am also not sure that I am doing it the right way , please help!

               

 

 

 

 

 

binny
Top achievements
Rank 1
 answered on 14 Apr 2016
2 answers
108 views

I'm trying to bind to a templated column with a radDropDownList control in it. I am using editmode=batch on the grid. So when editing no events are fired server side.

How do I go about binding to the dropdownlist when the grid is populated server side. I tried binding to the dropdownlist when the grid is built server side in the itemdatabound event but the e.Item.FindControl("radddlParameterId") does not find the control.

I want the grid to show text and then when edited switch to the populated dropdownlist that the user can select from.

Thanks,

Steve

Steve
Top achievements
Rank 1
 answered on 14 Apr 2016
3 answers
134 views
Dear Sirs

I ran into a nasty problem thats really annoying me. I setup a Rad Grid with various groupings.
I can now expand and collapse those groups and it gets remembered over postbacks.
Once i click into "edit" on an item, all collapsed / expanded groups revert to their original state (either all expanded or all collapsed)

Why isnt it keeping my collapse/expand state?

Thanks for the help

Chris
Eyup
Telerik team
 answered on 14 Apr 2016
9 answers
606 views

Hi,

I've looked at a few examples of performance improvement for grids that deal with lots (160K) records.  I haven't seen anything yet that looks at using the OFFSET/LIMIT functionality that you often see with web services.  Why is that?

It strikes me that if you can do it for web services then the standard grid should be able to cope with this,  performance would be dramatically improved.

Anyway if anyone has a good example of using a radgrid with OFFSET/LIMIT interfacing to a stored procedure I'd be very grateful to get a pointer to it!

Regards

Jon

Marin
Telerik team
 answered on 14 Apr 2016
6 answers
246 views
hello

I am loading an image in a radimage editor. I am resizing the image and I found that these operations are not reflected in the server side. Why it is like this? I want every change to be available on the server side. Suppose I load the image and rotate and resize it, I want these to be available on the server. Is this possible?

thanks
lovella
Vessy
Telerik team
 answered on 14 Apr 2016
3 answers
306 views

Hi

Just need some help converting a VB grid to C#.

Binding is to a datatable deserialised from JSON using NewtonSoft.Json library.

I have the following line in VB that works OK:

If e.Appointment.DataItem("UsageType") = 1 Then...

However the same line in C# 

if (e.Appointment.DataItem("UsageType") == 1) {

Errors with a red squiggle under DataItem with the following text:-

SchedulerEventArgs does not contain a definition for Dataitem and no extension method DataItem accepting a first argument of type SchedulerEventArgs could be found.

I have the following using statements:

using Telerik.Web.UI;
using Telerik.Web;
using System.Data;

 

Konstantin Dikov
Telerik team
 answered on 14 Apr 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?