Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
119 views
Hi,

I have been working with the chart control to make a line chart with x & y values from an external data source. The x values may be very unevenly spaced decimals values or negative numbers, so I need to set the items on this axis from code. Can someone give me a good example of how to do this?

I have a poorly functioning example below. Unfortunately, this example graphs both values as two lines.
protected void Page_Load(object sender, EventArgs e)
{
    List<MyObject> myList = new List<MyObject>();
 
    myList.Add(new MyObject { yValue = 3, xValue = -20 });
    myList.Add(new MyObject { yValue = -1, xValue = -10 });
    myList.Add(new MyObject { yValue = -5, xValue = 3 });
    myList.Add(new MyObject { yValue = 1, xValue = 5 });
    myList.Add(new MyObject { yValue = 8, xValue = 6.5 });
    myList.Add(new MyObject { yValue = 4, xValue = 7 });
    myList.Add(new MyObject { yValue = 3, xValue = 10 });
    myList.Add(new MyObject { yValue = 7, xValue = 15 });
 
    RadChart1.PlotArea.XAxis.IsZeroBased = false;
    RadChart1.DataSource = myList;
    RadChart1.PlotArea.XAxis.DataLabelsColumn = "xValue";
     
    RadChart1.DataBind();
}
 
public class MyObject
{
    public double yValue { get; set; }
    public double xValue { get; set; }
}

Thank you for you help!
Dan
Yavor
Telerik team
 answered on 15 Sep 2011
4 answers
2.2K+ views
Hi,
   This is an exception i get in my application, This doesn't happen often, but happens some times

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near '

<!DOCTYPE html PUB'.

Can any one please help me on this?

Alex
Top achievements
Rank 1
 answered on 15 Sep 2011
1 answer
95 views
When I do sorting on the grouped item in group header get this error. 

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


I bind data and create columns to the grid from code behind on pageload. Am i missing something?
Thanks in advance for your support.

Regards,
Vijay
Princy
Top achievements
Rank 2
 answered on 15 Sep 2011
0 answers
140 views
Many people here ask about how to do either client or server filtering. What about both? And are there any best practices for balancing this?

Say you have a database with a million transactions from which you want to select only items from this year, an dyou know there are about 100 thousand of these. With a good database query this may return results quickly but there is overhead for going to the server, and then the resulting data needs to be paged.

For subsequent filtering when the user changes the filter in the grid, we have some options:
1) Go back to the server and perform another query from scratch using the user-defined refinement.
2) Go back to the server, and just refine the already selected subset of data stored in state "somewhere" (maybe a LINQ query on a collection stored in cache, rather than a SQL query to a relational database).
3)  Filter the current subset on the client.

The ultimate question is, how do we know if the user wants to filter the subset of data, or if they want to filter on all data? For the above example, if we have a grid that displays countries and the filter is set to EqualTo USA, is that all USA transactions regardless of date, or all transactions for this year in the USA?

The user needs a button or other mechanism that clarifies their intent.  For this we have seen examples where a text box is used for the user to enter a pre-filter, and the grid always operates on the subset of data provided there.  In my opinion this is redundant and inadequate compared with the more sophisticated filter mechanism already provided in the grid.

How are people dealing with this? When a user changes their filter, which of the three above operations are you performing, and how do you allow the user to go back to a full query or refine their selection?

Thanks!
TonyG
Top achievements
Rank 1
 asked on 14 Sep 2011
0 answers
132 views
I am trying to loop through a radGrid with jQuery to access it Edit link. So basically what I want to do is show a modal dialog whenever the Edit link is clicked. I have the Modal dialog working using jquery and it is activated based on the .click jquery event. Is there a way to make it so when ever you click an Edit link in the radGrid it activates that?

This is my jquery code:
<script>
 
    $(document).ready(function() {
 
        //select all the a tag with name equal to modal
        $("#imgBtnBack").click(function(e) {
        if (($("#radTextBoxNotes_text").val().length === 0) && ($('#rblChangeButtonType input:checked').val() == '100000000') && ($("#RadDatePicker1").val().length === 0)) {
                history.back();
                return false;
            } else {
                //Cancel the link behavior
                e.preventDefault();
                //Get the A tag
                var id = "#dialog";
 
                //Get the screen height and width
                var maskHeight = $(document).height();
                var maskWidth = $(window).width();
 
                //Set height and width to mask to fill up the whole screen
                $('#mask').css({ 'width': maskWidth, 'height': maskHeight });
 
                //transition effect    
                $('#mask').fadeIn(0);
                $('#mask').fadeTo("fast", 0.8);
 
                //Get the window height and width
                var winH = $(window).height();
                var winW = $(window).width();
 
                //Set the popup window to center
                $(id).css('top', winH / 2 - $(id).height() / 2);
                $(id).css('left', winW / 2 - $(id).width() / 2);
 
                //transition effect
                $(id).fadeIn(0);
            }
        });
        //if close button is clicked
        $('.window .close').click(function(e) {
            //Cancel the link behavior
            e.preventDefault();
            $('#mask, .window').hide();
        });
 
        //if mask is clicked
        $('#mask').click(function() {
            $(this).hide();
            $('.window').hide();
        });
    });
    function OnClientClicked(sender, eventArgs) {
        //if close button is clicked
        $('.window .close').click(function(e) {
            //Cancel the link behavior
            e.preventDefault();
            $('#mask, .window').hide();
        });
        
    }
</script>


Thanks!
Justin
Top achievements
Rank 1
 asked on 14 Sep 2011
1 answer
61 views
when I have controls inside form template which is inside radgrid I am unable to
see them in design view, only grid is visible forcing me to move form template controls
to user control or manually design layout in code view. Is this a bug or supposed to be like that ?
I can not justify implementing a user control for that so right now I am using another temp aspx page where
I do layout and then paste it in form template, not very efficient :(
Jayesh Goyani
Top achievements
Rank 2
 answered on 14 Sep 2011
1 answer
196 views
Hi
I need to place 2 colums inside grid that 2 columns(Radshowattendedtraining,RadshowProvidedtraining) are two different grid please see the code below my problem is i am not able to use grid inside template column only outer grid is visible in code behind but in asp.net control  it is possible to bind the data.plaese suggest iam new to telerik

<

 

asp:Panel runat="server" ID="InnerContainer" >

 

 

 

 

<telerik:RadGrid ID="Radshowtraining" AllowMultiRowSelection="false" AllowSorting="false" runat="server" GridLines="None"

 

 

AllowFilteringByColumn="true" AllowPaging="true" AutoGenerateColumns ="false" PageSize="10" >

 

 

<ClientSettings EnableRowHoverStyle="true" ReorderColumnsOnClient="True" >

 

 

<Selecting AllowRowSelect="true" />

 

 

</ClientSettings>

 

 

 

<MasterTableView Width="100%" AllowMultiColumnSorting="false" AutoGenerateColumns="false"

 

 

DataKeyNames="Id" ClientDataKeyNames="Id">

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn UniqueName="TemplateDeleteColumn" HeaderText="Attended"

 

 

AllowFiltering="false" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle"

 

 

ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150px">

 

 

<ItemTemplate>

 

 

<telerik:RadGrid ID="Radshowattendedtraining" AllowMultiRowSelection="false" AllowSorting="false" runat="server" GridLines="None"

 

 

AllowFilteringByColumn="true" AllowPaging="true" AutoGenerateColumns ="false" PageSize="10">

 

 

<MasterTableView Width="100%" AllowMultiColumnSorting="false" AutoGenerateColumns="false">

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="Id" HeaderText="Id" Visible ="false" />

 

 

<telerik:GridBoundColumn DataField="Training" HeaderText="Training" />

 

 

<telerik:GridBoundColumn DataField="StartDate" HeaderText="Start Date" />

 

 

<telerik:GridBoundColumn DataField="EndDate" HeaderText="End Date" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn UniqueName="TemplateDeleteColumn" HeaderText="Provided"

 

 

AllowFiltering="false" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle"

 

 

ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150px">

 

 

<ItemTemplate>

 

 

<telerik:RadGrid ID="RadshowProvidedtraining" AllowMultiRowSelection="false" AllowSorting="false" runat="server" GridLines="None"

 

 

AllowFilteringByColumn="true" AllowPaging="true" AutoGenerateColumns ="false" PageSize="10">

 

 

<MasterTableView Width="100%" AllowMultiColumnSorting="false" AutoGenerateColumns="false">

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="Id" HeaderText="Id" Visible ="false" />

 

 

<telerik:GridBoundColumn DataField="Training" HeaderText="Training" />

 

 

<telerik:GridBoundColumn DataField="StartDate" HeaderText="Start Date" />

 

 

<telerik:GridBoundColumn DataField="EndDate" HeaderText="End Date" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<GroupingSettings CaseSensitive="false" />

 

 

</telerik:RadGrid>

 

 

</asp:Panel>

 

Jayesh Goyani
Top achievements
Rank 2
 answered on 14 Sep 2011
2 answers
182 views
Hello,

I followed this tutorial to implement filter on gridbuttoncolumn:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/filtering-and-sorting-for-gridbuttoncolumn.aspx

But When I click on the filter button I get the following error:

Telerik.Web.UI.ParseException: Expression expected    at Telerik.Web.UI.ExpressionParser.ParsePrimaryStart()     at Telerik.Web.UI.ExpressionParser.ParsePrimary()     at Telerik.Web.UI.ExpressionParser.ParseUnary()     at Telerik.Web.UI.ExpressionParser.ParseMultiplicative()     at Telerik.Web.UI.ExpressionParser.ParseAdditive()     at Telerik.Web.UI.ExpressionParser.ParseComparison()     at Telerik.Web.UI.ExpressionParser.ParseLogicalAnd()     at Telerik.Web.UI.ExpressionParser.ParseLogicalOr()     at Telerik.Web.UI.ExpressionParser.ParseExpression()     at Telerik.Web.UI.ExpressionParser.ParseArguments()     at Telerik.Web.UI.ExpressionParser.ParseArgumentList()     at Telerik.Web.UI.ExpressionParser.ParseIif()     at Telerik.Web.UI.ExpressionParser.ParseIdentifier()

Could you please Help on this.

PS: my version of Telerik is 2010.1.415.35
Martin
Telerik team
 answered on 14 Sep 2011
6 answers
267 views
Hi,

I am creating a dynamic raddock  then storing into database.  When I do a postback  I am  not retreiving and displaying the raddock in saved BUT on a 2nd postback it is working ok.  The bigger problem is that if I run again it should pull from database and display raddock in zones that was last saved loads the raddock in the original position.   It seems that I am missing something in _init.  
I have reviewed on-line example and forums but  have not found anything to solve my problem.  

 

<table>

 

 

 

<tr><td><asp:button runat="server" id="Button1" text="save dashboard" />

 

 

 

<br/><br/></td></tr>

 

 

 

 

<telerik:raddocklayout runat="server" enableviewstate="false" id="RadDockLayout1" onloaddocklayout="RadDockLayout1_LoadDockLayout" Skin="Web20"

 

 

 

onsavedocklayout="RadDockLayout1_SaveDockLayout" storelayoutinviewstate="false" >

 

 

 

<tr>

 

 

 

 

<td valign="top">

 

 

 

 

 

 

 

<telerik:raddockzone runat="server" id="RadDockZone1" width="402px" min-height="200px">

 

 

 

 

</telerik:raddockzone>

 

 

 

</td>

 

 

 

<td valign="top">

 

 

 

<telerik:raddockzone runat="server" id="RadDockZone2" width="402px" min-height="200px">

 

 

 

</telerik:raddockzone>

 

 

 

</td></tr>

 

 

 

<tr><td colspan="2"><telerik:raddockzone runat="server" id="RadDockZone3" Width="820px" MinHeight="200px" >

 

 

 

 

</telerik:raddockzone></td></tr>

 

 

 

</table>

 

 

 

 

</telerik:raddocklayout>

 

 

 



 

private void Page_Load(object sender, System.EventArgs e)

 

{

 

}

 

 

 

private List<DockState> CurrentDockStates

 

{

 

 

get

 

 

{

 

//Get saved state string from the database - set it to dockState variable for example

 

 

 

string dockStatesFromDB = "";

 

 

 

string loginID = "xxx";

 

 

 

string loginPassword = "xxx";

 

 

 

using (XcendaDC1DataContext context = new XcendaDC1DataContext())

 

{

 

 

var users = from u in context.tbUsers

 

 

 

where (u.U_userLogin.Contains(loginID) && u.U_userPassword.Contains(loginPassword))

 

 

 

select u;

 

 

 

var x = users.FirstOrDefault();

 

 

 

if (x != null)

 

{

dockStatesFromDB = x.U_dockState;

 

}

}

 

 

List<DockState> _currentDockStates = new List<DockState>();

 

 

 

string[] stringStates = dockStatesFromDB.Split('|');

 

 

 

foreach (string stringState in stringStates)

 

{

 

 

if (stringState.Trim() != string.Empty)

 

{

_currentDockStates.Add(

 

DockState.Deserialize(stringState));

 

}

}

 

 

return _currentDockStates;

 

}

}

 

 

 

 

protected void Page_Init(object sender, EventArgs e)

 

{

 

 

int docksCount = CurrentDockStates.Count;

 

 

 

// raddock1

 

 

 

RadDock raddock1 = new RadDock();

 

raddock1.ID =

 

string.Format("RadDock{0}", docksCount);

 

raddock1.Title =

 

"Products";

 

 

 

// raddock1.Text = string.Format("Added at {0}", DateTime.Now);

 

 

raddock1.UniqueName =

Guid.NewGuid().ToString();

 

raddock1.Width =

 

Unit.Pixel(300);

 

raddock1.Skin =

 

"Web20";

 

 

 

RadGrid gv = new RadGrid();

 

 

 

ArrayList arrListProducts = new ArrayList();

 

arrListProducts.Add(

 

"product 1");

 

arrListProducts.Add(

 

"product 2");

 

arrListProducts.Add(

 

"product 3");

 

arrListProducts.Add(

 

"product 4");

 

arrListProducts.Add(

 

"product 5");

 

arrListProducts.Add(

 

"product 6");

 

arrListProducts.Add(

 

"product 7");

 

gv.DataSource = arrListProducts;

gv.DataBind();

raddock1.ContentContainer.Controls.Add(gv);

raddock1.Commands.Add(

 

new DockCloseCommand());

 

raddock1.Commands.Add(

 

new DockExpandCollapseCommand());

 

 

RadDockZone1.Controls.Add(raddock1);

}

 

 

 

 

 

 

 

protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)

 

{

 

 

//Populate the event args with the state information. The RadDockLayout control

 

 

 

// will automatically move the docks according that information.

 

 

 

foreach (DockState state in CurrentDockStates)

 

{

e.Positions[state.UniqueName] = state.DockZoneID;

e.Indices[state.UniqueName] = state.Index;

}

}

 

 

 

 

protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)

 

{

 

 

List<DockState> stateList = RadDockLayout1.GetRegisteredDocksState();

 

 

 

StringBuilder serializedList = new StringBuilder();

 

 

 

int i = 0;

 

 

 

while (i < stateList.Count)

 

{

serializedList.Append(stateList[i].ToString());

serializedList.Append(

 

"|");

 

i++;

}

 

 

string dockState = serializedList.ToString();

 

 

 

if (dockState.Trim() != String.Empty)

 

{

 

 

string loginID = "myID";

 

 

 

string loginPassword = "myPassword";

 

 

 

using (XcendaDC1DataContext context = new XcendaDC1DataContext())

 

{

 

 

var users = from u in context.tbUsers

 

 

 

where (u.U_userLogin.Contains(loginID) && u.U_userPassword.Contains(loginPassword))

 

 

 

select u;

 

 

 

var x = users.FirstOrDefault();

 

 

 

if (x != null)

 

{

x.U_dockState = dockState;

context.SubmitChanges();

}

}

}

}

 

Slav
Telerik team
 answered on 14 Sep 2011
3 answers
168 views
I there.

I've a timetable in a WeekDay view. Depending on the information got from the datasource, sometimes I have more than 10 concurrent appointments for and sometimes I have only 1 or 3 appointments at the same time. In the case where I have 10 appointments I have to increase the radscheduler width but in cases I have only 1 or 3 appointments I don't want to change the width.

I don't if it is possible, but I want to in someway to resize automatically the radscheduler based in the number of appointments at the same time. 
For instance, in a weekview, if the maximum number of concurrent appointments is 2 then I would like to set the radsched width to 500px, if I have 5 concurrent appointments I would like set to 800px and if I have 10 concurrent appointments I'de like to set width to 1000px.

Is that possible? There is another approach for this problem?


Thanks




Ivana
Telerik team
 answered on 14 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?