Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
122 views
Hi,

I am trying to create a calculated column, which I have succeeded in doing, but filtering and grouping is triggering a javascript exception.

This is my code:

<telerik:RadGrid ID="timesheetGrid" runat="server" GridLines="None" Skin="Windows7"AllowSorting="True" ShowGroupPanel="True" AutoGenerateColumns="False" AllowPaging="True"
    PageSize="15" ShowStatusBar="True" AllowFilteringByColumn="True" AllowMultiRowSelection="True"
    OnNeedDataSource="timesheetGrid_NeedDataSource" OnPreRender="timesheetGrid_PreRender"
    ViewStateMode="Enabled" onitemdatabound="timesheetGrid_ItemDataBound" Width="970px">
    <ClientSettings EnableRowHoverStyle="true" AllowColumnsReorder="True" ReorderColumnsOnClient="True"
        AllowDragToGroup="True">
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ID" EditMode="EditForms">
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
        <Columns>
            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" Visible="False"
                ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="From" DataType="System.DateTime"
                HeaderText="Date" UniqueName="DateFrom" ReadOnly="true" DataFormatString="{0:dd/MM/yyyy}" FilterControlWidth="100px" HeaderStyle-Width="100px">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="User.UserName" HeaderText="User" UniqueName="User"
                ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridNumericColumn UniqueName="Duration" HeaderText="Duration" DataType="System.Double" HeaderStyle-Width="30px" FilterControlWidth="30px">
                <ItemStyle HorizontalAlign="Right"/>
            </telerik:GridNumericColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="DocketNo" HeaderText="Docket No" UniqueName="DocketNo"
                ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FileCode" HeaderText="File Code" UniqueName="FileCode" HeaderStyle-Width="50px" FilterControlWidth="50px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FileCodeID" HeaderText="File Code ID" UniqueName="FileCodeID"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CostCenter" HeaderText="Cost Center" UniqueName="CostCenter" HeaderStyle-Width="50px" FilterControlWidth="50px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CostCenterID" HeaderText="Cost Center ID" UniqueName="CostCenterID"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CompanyID" HeaderText="Company ID" UniqueName="CompanyID"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn DataField="IsNegativeTimesheet" DataType="System.Boolean"
                HeaderText="Negative Timesheet" UniqueName="NegativeTimesheet" ReadOnly="true">
            </telerik:GridCheckBoxColumn>
            <telerik:GridCheckBoxColumn DataField="IsOvertime" DataType="System.Boolean" HeaderText="Overtime"
                UniqueName="Overtime" ReadOnly="true">
            </telerik:GridCheckBoxColumn>
        </Columns>
        <EditFormSettings UserControlName="UserControls/TimesheetEdit.ascx" EditFormType="WebUserControl">
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle Mode="NumericPages" VerticalAlign="Bottom" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Windows7">
    </HeaderContextMenu>
</telerik:RadGrid>


Column Calculation:
protected void timesheetGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem row = e.Item as GridDataItem;
        TimeSheet item = e.Item.DataItem as TimeSheet;
        if (item != null)
        {
            double duration = item.To.TimeOfDay.TotalHours - item.From.TimeOfDay.TotalHours;
            row["Duration"].Text = duration.ToString();
        }
        else
        {
            row["Duration"].Text = "0";
        }
    }
}

Exception:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Expression cannot be null or empty.

Attached image.

Any help would be greatly appreciated.

Many thanks,
Daryl
Alan
Top achievements
Rank 1
 answered on 24 Feb 2011
1 answer
122 views
I'm trying to create an application that will display real-time logging of server-side events and show the status of these events within an ajaxpanel. I'm performing tasks such as extracting a zip file, copy files/folders to other locations, and deleting files and folders... all on the server where the application will be hosted.

I would like the status of each of these processes to be displayed to the user... for example:

- zip file is now being extracted... complete
- now searching for audio folder... complete
- now copying audio folder contents to driver folder... complete

... and so on

Can anyone suggest how this can be implemented?

Thanks!
Iana Tsolova
Telerik team
 answered on 24 Feb 2011
1 answer
238 views
Hi,

I have a Grid with the AutoGenerated Columns set to true and The Edit,Delete Column defined in the MasterTableView in design time. Currently the Edit and Delete columns appear to be on the left hand side and the AutoGenerated columns next to Edit and delete columns. Now we need to shift the Edit and delete columns to the right without affecting the sequence of the columns generated. We have tried swapping the columns technique but it seems to effect the sequence of autogenerated columns.

Please can you let us know the direct way to achieve this a bit urgently.

Below is the part of code for your reference which creates the Edit Delete column to the left:

<telerik

 

 

:RadGrid AutoGenerateColumns="true" ID="grid" runat="server" AllowSorting="True"

 

 

 

 

 

 

AllowPaging="true" ShowFooter="false">

 

 

 

<GroupHeaderItemStyle></GroupHeaderItemStyle>

 

 

 

<FilterMenu>

 

 

 

</FilterMenu>

 

 

 

<MasterTableView CommandItemDisplay="Top">

 

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

 

<RowIndicatorColumn Visible="False" UniqueName="RowIndicator">

 

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

 

<ItemStyle></ItemStyle>

 

 

 

</RowIndicatorColumn>

 

 

 

<EditFormSettings>

 

 

 

<EditColumn Visible="false" UniqueName="EditCommandColumn">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

<ExpandCollapseColumn Visible="False" UniqueName="ExpandColumn" ButtonType="ImageButton">

 

 

 

<HeaderStyle Width="19px"></HeaderStyle>

 

 

 

</ExpandCollapseColumn>

 

 

 

<CommandItemTemplate>

 

 

 

 

</CommandItemTemplate>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="" UniqueName="Edit"

 

 

 

AllowFiltering="false">

 

 

 

<HeaderStyle Width="1%" />

 

 

 

<itemtemplate>

 

 

 

 

<a href="#" id="A3" title="Edit" onclick="OpenWindow(<%# DataBinder.Eval(Container.DataItem,"id") %>)">

 

<%

 

--<img onclick="javascript:handler('','ctl00_MainContentHolder_RadPanelBar3_i0_i0_grid','<%# Container.ItemIndex %>')" style="border: 0" src="images/Edit.png" alt="Edit" />--%>

 

 

 

 

<eui:eLabel ID="lblEdit" runat="server" Text="Edit" CssClass="label" ForeColor="Blue"></eui:eLabel>

 

 

 

</a>

 

 

 

</itemtemplate>

 

 

 

<itemstyle cssclass="MyImageButton" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

<telerik:GridTemplateColumn HeaderText="" UniqueName="Delete"

 

 

 

AllowFiltering="false">

 

 

 

<HeaderStyle Width="1%" />

 

 

 

<itemtemplate>

 

 

 

<asp:TextBox id="txt1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "id")%>' style="display:none" ></asp:TextBox>

 

 

 

<a href="#" id='<%# DataBinder.Eval(Container.DataItem, "id")%>' title="Delete" onclick='Textt(this)'>

 

<%

 

--<img onclick="javascript:handler('','ctl00_MainContentHolder_RadPanelBar3_i0_i0_grid','<%# Container.ItemIndex %>')" style="border: 0" src="images/Delete.png" alt="Delete" />--%>

 

 

 

 

<eui:eLabel ID="lblDelete" runat="server" Text="Delete" CssClass="label" ForeColor="Blue"></eui:eLabel>

 

 

 

</a>

 

 

 

</itemtemplate>

 

 

 

<itemstyle cssclass="MyImageButton" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

</Columns>

 

 

 

 

<ItemStyle></ItemStyle>

 

 

 

<AlternatingItemStyle/>

 

 

 

<CommandItemStyle />

 

 

 

</MasterTableView>

 

 

 

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

 

 

 

<ClientSettings EnableRowHoverStyle="false">

 

 

 

<ClientEvents />

 

 

 

<Selecting AllowRowSelect="false"></Selecting>

 

 

 

<Resizing AllowRowResize="false" EnableRealTimeResize="false" ResizeGridOnColumnResize="false"

 

 

 

AllowColumnResize="false"></Resizing>

 

 

 

</ClientSettings>

 

 

 

</telerik:RadGrid>

 





Thanks in Advance.
Shinu
Top achievements
Rank 2
 answered on 24 Feb 2011
1 answer
226 views
hi

i have used this line to get the row index in the textchanged event but i didnt get any value and this is the line

int i = ((GridDataItem)(((RadNumericTextBox)sender).NamingContainer)).ItemIndex;
how to get the row index in text changed event
Iana Tsolova
Telerik team
 answered on 24 Feb 2011
8 answers
285 views

I've found what appears to be a bug with the bullets and number options in the Editor control.

When in the editor enter some text and click the Numbering button to give you something like this:

  1. text

Press ENTER twice to get back to a normal paragraph and then enter another line of text with a bullet.  This will either work (randomly) or will indent the text directly below the numbered list above as a bullet giving a <UL> inside of the <OL> tag above it.  If you then click the bullet button to remove the bullet it will be removed but then cannot be put back again using the button.  Once you're in this position it seems impossible to reformat everything again and the entire section must be removed including the <OL> above or you never get the items where intended.

Ironically whilst trying to give examples in this post I have come across the same problem!  I don't know if this page is using the same control or not but it's most frustrating.

Is this something you've come across?

Thanks

Dave

Rumen
Telerik team
 answered on 24 Feb 2011
6 answers
186 views
hi

how cn i change the back color of the row where i expanded a detail table?

thanks and regards
webster velasco
paul
Top achievements
Rank 1
 answered on 24 Feb 2011
1 answer
948 views
I have a RadGrid who's filter expression I am setting from a saved value in a datastore on page load.  Setting the filter programmatically seems to work just fine, however, as soon as I try to modify the filter (manually through the web interface) I loose all the filter information set in the page load method.  This only happens the first time I change the filters after loading the page.  After that, all filtering is persisted properly.  Here's the code that programmatically sets the filter expresssion:


protected void LoadFilterExpressionFromSettings(GridTableView tbView, string filterExpression, Dictionary<string, Pair> dicColumns)
{
    tbView.FilterExpression = Settings.ListFilterExpression;
    foreach(KeyValuePair<string, Pair> p in dicColumns)
    {
        tbView.GetColumn(p.Key).CurrentFilterValue = ((Pair)p.Value).First.ToString();
        tbView.GetColumn(p.Key).CurrentFilterFunction = (GridKnownFunction)((Pair)p.Value).Second;
    }
}



The FilterExpression is set on the first line.  The loop goes through each column to set the GirdFilterItem's TextBox.

------------------------------------------------------------------------------------------------------------------------------

Example (of what's going one):

RadGrid:

FirstName               LastName             Age
=================================
Bob                         Johnson                 28
Jane                        Johnson                 28
Sue                         Hanson                  28
John                        Smith                     31
Henry                      Smith                     23
Hilary                      Porter                     31 
=================================

On page load, I might set a filter for the 'LastName' column ('Johnson').  After the page loads, I try to manually filter the age column to '28' but it resets the 'LastName' column filter (to NoFilter).  When I change the 'LastName' column filter back to 'Johnson', it works just fine and the age filter persists as well.  So it's just the first change I make that resets the filters which were programmatically set.

Any help is very welcome!

Trevor



Marin
Telerik team
 answered on 24 Feb 2011
3 answers
278 views
I am using the Q3-2009 release and have successfully added static vertical lines as another series to a horizontal bar graph. The bar graph is a percentile representation of data with the vertical lines being the low end of a series of targets. I have scaled the graph to start at the low and high ends of the targets, with a little room above and below so that the lowest value in the data series is shown and the target series is shown clearly with outliers in the data series shown extending past the edge of the graph.

All of that works perfectly and I can upload a sample project that demonstrates the basics of how that is accomplished. What isn't working is the positioning of the SeriesItem labels. Your RadChart help references the [SeriesItem].Label.Appearance property, which is a broken link, and I drilled into the lightly documented (i.e. What's the Single value represent, pixels, percent of chart area?) API help for info on .Position.X and .Position.Y. 

Here is the code I'm trying to implement.

            var targetLine = new ChartSeries
                                 {
                                     Type = ChartSeriesType.Line
                                 };
            // To get a vertical line, the series has to be added for each person
            int countTeam = SampleData.Rows.Count;

            // Setup first item with label
            targetLine.AddItem(value);
            // Show labels only on this first series item
            ChartSeriesItem item = targetLine.Items[0];
            item.Label.Visible = true;
            item.Label.Appearance.RotationAngle = 90;
            item.Label.TextBlock.Text = "#Y{P1}";

            // Show the rest of the series items without labels
            for (int i = 1; i < countTeam; i++)
            {
                targetLine.AddItem(value);
                targetLine.Items[i].Label.Visible = false;
            }
            RadChart1.AddChartSeries(targetLine);
            ... (removed series color coding)
            // Try to reposition the labels with the end goal to be to draw them 
            // below the scale with a label connector line
            // BUG: this fails to relocate
            item.Label.Appearance.Position.Auto = false;
            item.Label.Appearance.Position.X += 10;  // Using random numbers at this point since nothing is happening, there's
            item.Label.Appearance.Position.Y += 10;  // no documentation, and I don't know if X & Y are axis or screen oriented
            item.Label.Appearance.LabelConnectorStyle.Visible = true;

The labels show up as they should, only one on the first item in the series, i.e. the bottom of the chart, but it refuses to move at all from the spot it is automatically drawn. Am I trying to affect this at the wrong point of its creation or is the documentation missing something and/or the interface exposing something it shouldn't, i.e. Position.X and Position.Y being public writable when they don't actually have any affect?
Evgenia
Telerik team
 answered on 24 Feb 2011
2 answers
154 views
Sirs,

I currently have a splitter with a sliding zone with one pane for instructions, a second pane (id = RadPane3)with a rad scheduler looking at a sql table named diary. I have a need to not only show but edit the contact details for the visiting part. I use a grid in a third pane (id=RadPane4) for this - the datasource uses the appointment attribute client ref to retrieve data from the database.

The show part is easy enough by declaring custom attributes linked to the select query of the datasource.
As the contact details are held in a different table to the diary I have diabled the "start editing in advance form" option and tied the onappointmentupdated command as follows

Protected Sub Radscheduler1.AppointmentUpdate (ByVal sender As Object, ByVal e as Telerik.Web,UI.AppointmentUpdateEventArgs) Handles Radschedule1AppointymentUpdate

HiddenField.Value = e.appointment.Attributes("ClientRef")
Radgrid1.Databind
RadPane3.Collapsed=True
RadPane3.Visible=False
RadPane 4.Collapsed=False
RadPane4.Visible=True

end sub

Is there a way that I can insert into here a command that will automatically open RadGrid1 in edit mode without the user having to click the edit button ?

many thanks in advanced

Padster
BRK
Top achievements
Rank 1
 answered on 24 Feb 2011
1 answer
186 views
Hi,

In our project, we are using nested RadGrid, on click of any row, we
show RadListView as a child.
For performance point of view, we used pagination to both Parent Grid as well as for nested RadListView (Child).
AllowPaging=True to both parent & Child
On click of any grid row , we pass ID i.e one of the grid column data (in Grid's ItamDataBound event) as a input to Child RadListView.

my issue is that, whenever i select PageSize from Combobox or any paging button which is inside child RadListview, it calls only RadListViewObjectDataSource's OnSelecting mehtod, due to that the webservice gets input parameter as a empty.
and returns all records which is not related to that specific row.


My Question is where i set the input parameter, so that on a selection of page size in the ListView, the proper parameter could be send to webservice.






arun
Top achievements
Rank 1
 answered on 24 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?