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

I am developing webparts for Sharepoint using Telerik Controls.
I need to put a RadGrid inside a RadWindow so users could acces it when searching for specific data.
RadGrid data change while choosing specific fields from Combobox from a different control.
My problem is the RadGrid Data that is inside the RadWindow is not changing.
I am opening the RadWindow from javascript and reloading RadGrid Data from server side.
Can you help me with this issue please.

Thank you in advance.

Fady
Marin Bratanov
Telerik team
 answered on 20 Sep 2011
2 answers
148 views
Hi all,

Basically i have a grid which is declared statically, as in the following example:

 http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html#Section1

Now when i declare the columns in the markup, everything works fine (grouping/ filtering / self reference hierarchy, by the way, in the following example the hierarchy is not declared, i know hehe).

EDIT: Solved the grouping problem, it was a mistake with the execution of the grid creation procedure.

Now problem is, when i run a procedure in code-behind that creates the columns / hierarchy, the needdatasource handler doesnt seem to work...and starts throwing errors regarding "Multiple textbox with the same Id" or something similar when i try to drag and group by a column, filter works, and the hierarchy doesn't. My datasource is a list of entities using the IEnumerable interface, so from what i have read, it should not cause any problems D:

Attaching code-behind:

EDIT: Still having problem creating the hierarchy from code-behid.

protected void CreateGridStructure()
{                                 
    RadGrid1.MasterTableView.DataKeyNames = new string[] { "ElementoJerarquia.Parent.Id", "ElementoJerarquia.Id" };
    RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { "Id", "Numero", "Responsable.NombreCompleto", "ElementoJerarquia.Nombre" };
    RadGrid1.MasterTableView.FilterExpression = "ElementoJerarquia.Parent.Id IS NULL";
 
    RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
    RadGrid1.MasterTableView.SelfHierarchySettings.KeyName = "ElementoJerarquia.Parent.Id";
    RadGrid1.MasterTableView.SelfHierarchySettings.ParentKeyName = "ElementoJerarquia.Id";
              
}

Also a little note, the procedure that reads "CrearBoundColumn", returns a GridBoundColumn object, it was just a test.

Thanks in advance for any help.
Trasto
Top achievements
Rank 1
 answered on 20 Sep 2011
17 answers
377 views
I am using the WebBlue skin, but my user wants the weekend color shaded darker. I added the following to my aspx:

.RadScheduler_WebBlue .rsContentTable .rsSatCol,

.RadScheduler_WebBlue .rsContentTable .rsSunCol

{

background:#8B8F91;

border-bottom-color:#d2d8db;

}

When first entring the screen, it is still the light blue. If I change to 24-hour, it is the new dark grey I specified. If I change back to Business Hours, it is then changed to the Dark Grey. How do I get the Dark Grey to show when I first enter the screen for the first time?

Thanks,
Susan

Plamen
Telerik team
 answered on 20 Sep 2011
2 answers
112 views
Hello.

In the following html page, the cursor is displayed in the login field when the page is loaded:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <title></title>
</head>
<body>
    <center>
    <form id="form1" runat="server" method="post" action="">
        <table style="background:#cccccc" cellpadding="2" cellspacing="3">
            <tr align="center">
                <td></td>
                <td align="right"><label>Login: </label></td>
                <td align="left"><input type="text" id="login" style="width:140px" maxlength="30" /></td>
                <td></td>
            </tr>
            <tr align="center">
                <td></td>
                <td align="right"><label>Password: </label></td>
                <td align="left"><input type="text" id="password" style="width:140px" maxlength="30" /></td>
                <td></td>
            </tr>
        </table>
        <br />
  
        <input type="button" value="Login" style="width:65px;" />
    </form>
    </center>
  
    <script type="text/javascript">
        document.forms["form1"]["login"].focus();
    </script>
</body>
</html>

However, when the corresponding aspx page is loaded (with the RadFormDecorator component), the cursor is no longer displayed:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="MemberJoin._Default" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head>
    <title></title>    
</head>
<body>
    <center>
    <form id="form1" runat="server" method="post" action="">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
          
        <table style="background:#cccccc" cellpadding="2" cellspacing="3">
            <tr align="center">
                <td></td>
                <td align="right"><label>Login: </label></td>
                <td align="left"><input type="text" id="login" style="width:140px" maxlength="30" /></td>
                <td></td>
            </tr>
            <tr align="center">
                <td></td>
                <td align="right"><label>Password: </label></td>
                <td align="left"><input type="text" id="password" style="width:140px" maxlength="30" /></td>
                <td></td>
            </tr>
        </table>
        <br />
          
        <input type="button" value="Login" style="width:65px;" onclick="validateLogin()" />
    </form>
    </center>
      
    <script type="text/javascript">
        document.forms["form1"]["login"].focus();
    </script>
</body>
</html>

No methods have been implemented in the code behind.
Why isn't the cursor being displayed?

Thank you in advance.
Paulo
Paulo
Top achievements
Rank 1
 answered on 20 Sep 2011
1 answer
408 views
I get the error:
Cannot add duplicate collection entry of type add with unique key attribute name set to Telerik_Web_UI_WebResource_axd

While trying to deploy my application. It works fine when I run it on my machine though:

The box I'm trying to deploy it on is iis7.5/Windows Server 2008 if that helps. Here are the offending lines of code from my web.config. if I comment them out the app runs, but the asyncupload control isn't visible.


<system.web>
    <httpHandlers>
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <defaultDocument>
      <files>
        <clear/>
        <add value="pcHome.aspx" />
      </files>
    </defaultDocument>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <!--<add name="ChartImage_axd" verb="*" preCondition="integratedMode" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" />
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />-->
    </handlers>
  </system.webServer>
Genady Sergeev
Telerik team
 answered on 20 Sep 2011
1 answer
100 views
Hello.

I'm developing a page with RadGrid. Grid should have ability to reorder positions of predefined columns and ability to hide some of them.
And I'm facing with very strange behavior. I prepared small example with this bug

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Web.Test" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager runat="server" />
         
        <telerik:RadGrid ID="grid" runat="server" AutoGenerateColumns="False">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn DataField="column1" UniqueName="column1" />
                    <telerik:GridBoundColumn DataField="column2" UniqueName="column2" />
                    <telerik:GridBoundColumn DataField="column3" UniqueName="column3" />
                    <telerik:GridBoundColumn DataField="column4" UniqueName="column4" />
                    <telerik:GridBoundColumn DataField="column5" UniqueName="column5" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:Button ID="btnButton" runat="server" Text="Press Me" />
    </div>
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace Web
{
    public partial class Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            grid.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(grid_NeedDataSource);
            btnButton.Click += new EventHandler(btnButton_Click);
        }
 
        void btnButton_Click(object sender, EventArgs e)
        {
            var columns = new string[] { "column5", "column2" };
            List<GridColumn> items = grid.Columns.Cast<GridColumn>().ToList();
            grid.Columns.Clear();
 
            for (int i = 0; i < columns.Count(); i++)
            { // Adding visible columns
                GridColumn column = items.FirstOrDefault(a => a.UniqueName == columns[i]);
                column.Visible = true;
                grid.Columns.Add(column);
            }
 
            for (int i = 0; i < items.Count; i++)
            { // Adding invisible columns
                if (!columns.Contains(items[i].UniqueName))
                {
                    items[i].Visible = false;
                    grid.Columns.Add(items[i]);
                }
            }
 
            grid.Rebind();
        }
 
        void grid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            grid.DataSource = Enumerable.Range(0, 5).Select(i => new {
                column1 = 1 * Math.Pow(10, i),
                column2 = 2 * Math.Pow(10, i),
                column3 = 3 * Math.Pow(10, i),
                column4 = 4 * Math.Pow(10, i),
                column5 = 5 * Math.Pow(10, i),
            });
        }
    }
}

It should display columns 1..5 after start and columns 5 and 2 after pressing a button is not it?
But what we see:
1) columns 1..5 after start, ok
2) when press a button - there are only 2 and 5 columns, but it should be 5 and 2, the order is wrong
3) press a button again - columns displayed changed (!) to 2 and 1

If we set breakpoint on grid.Rebind() line and look at grid.Columns we'll see that there is correct order (visible column5 and column2, then invisible column1, column 3, column4) every time. So I think that root of evil is in some AJAX logic or in grid rendering code. Or may be something is wrong with my code?
Iana Tsolova
Telerik team
 answered on 20 Sep 2011
1 answer
147 views
My insert command contains codes like these:

protected void grdcodelist_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
  //Get the GridEditFormInsertItem of the RadGrid
  GridDataInsertItem insertedItem = e.Item as GridDataInsertItem;
  if (insertedItem == null)
  {
    grdcodelist.Controls.Add(new LiteralControl("GridDataInsertItem is null"));
    e.Canceled = true;
    return;
  }
  // process continues
}

GridDataInsertItem is null when the following line is not there
grdcodelist.MasterTableView.EditMode = GridEditMode.InPlace;

I believe the default is EditForms.

With GridEditMode.InPlace, insert works. Update command is not affcted. Update works with or without GridEditMode.InPlace.

Any idea why insert only works with InPlace EditMode and not EditForms?
Iana Tsolova
Telerik team
 answered on 20 Sep 2011
3 answers
102 views
Hi,

I found a example in the documentation, but I did not find a full example with edit row / delete row and so on.

Do you have code example with those features?

Using the example available i was able to doble click a row to edit, but I am having trouble saving the row (index out of bounds).

Edit: Forgot to meintion that i need a example where the structure and everything else is in the code behind file, due to dynamic number of columns.
Iana Tsolova
Telerik team
 answered on 20 Sep 2011
7 answers
164 views
I am having difficulties integrating CustomValidators on the Advanced Insert and Edit forms. By difficulties I mean that they simply don't work. Did anybody encounter similar problems? What is the solution? Thanks
Ilya
Top achievements
Rank 1
 answered on 20 Sep 2011
2 answers
62 views
Hi,

in my application user got two options to select row:
1. click on row
2. clickt button that deselect current and selects next row server side
 
int indeks = 0;
           foreach (GridDataItem item in RadGNaglowek.MasterTableView.Items)
           {
               if (item.Selected)
               {
                   indeks = item.ItemIndex + 1;
                   if (item.ItemIndex != RadGNaglowek.MasterTableView.Items.Count - 1)
                       item.Selected = false;
               }
           }
           if (indeks == RadGNaglowek.PageSize)
           {
               indeks = 0;
               RadGNaglowek.CurrentPageIndex = RadGNaglowek.CurrentPageIndex + 1; 
               RadGNaglowek.MasterTableView.Rebind();
           }

After RadGrid is updated by RadAjaxManager, I need to run javascript code same as i run on user row click(select) :
<ClientEvents  OnRowSelected="RowClick"  />

How can I do it?
Wojciech
Top achievements
Rank 1
 answered on 20 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?