This is a migrated thread and some comments may be shown as answers.

RadComboBox disabled + AJAX

4 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 05 Sep 2008, 05:35 PM
Hi,

I have a GridTemplateColumn with a RadComboBox in its EditItemTeplate as follows :

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

SortExpression="FullName">

<ItemTemplate>

<asp:Label ID="lblRequestor" Width="100px" runat="server" Text='<%#Bind("RequestorID") %>'></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<telerik:RadComboBox AutoPostBack="true" DataTextField="FullName" EmptyMessage="-- Select Requestor --" AppendDataBoundItems="true" DataValueField="EmployeeUserId"

ID="RadComboBox1" runat="server" SelectedValue='<%#Bind("RequestorID") %>'>

</telerik:RadComboBox>

<asp:CustomValidator ID="CustomValidator1" ControlToValidate="RadComboBox1" OnServerValidate="ValidateRequestor" runat="server" ErrorMessage="Select Requestor"></asp:CustomValidator>

</EditItemTemplate>

<ItemStyle Width="100px" />

<HeaderStyle Width="100px" />

</telerik:GridTemplateColumn>



Now, in  grid OnItemCreated="RadGrid1_ItemCreated"  event handler, based on some condition(permissions), I'm setting the above RadComboBox Enabled property to false as follows :

if (Page.User.Identity.IsAuthenticated)

{

GridTableRow tblRowForInsert = formItem[

"Requestor"].Parent as GridTableRow;

tblRowForInsert.Enabled =

false;

}

It works fine with postbacks, but, if I use AJAX, the disabled RadComboBox's borders are not shown at the bottom and the control seems to look like as if bottom half is cut.

I tried getting the RadComboBox control using the FindControl Method of GridEditableItem and then setting its Enabled property to false , but that also gives the same results with AJAX enabled.

Can you please let me know how to fix this or if there's a workaround.

Thanks
-Raj

4 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 08 Sep 2008, 03:11 PM
Hi Raj,

This is indeed a strange visual glitch and unfortunately I am not able to recreate the problem locally. Can you please check whether the same issue occurs when you replace the RadComboBox instance with MS DropDownList or disable temporary the skin for the grid instance? I suspect that some of the combobox disabled styles get overridden at some point and produce the unwanted effect.

I will also appreciate if you provide a live url where the discrepancy can be observed. Thus we will be able to investigate the matter further and provide a solution for your particular case.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Raj
Top achievements
Rank 1
answered on 08 Sep 2008, 06:16 PM
Hi Stephen,

Thanks for the prompt reply.

While trying to create a sample project duplicating this scenario. I noticed taht this is the issue when combobox skin is office2007.

I'm not sure how to attach the sample project , so I'm pasting code from aspx, .cs and web.config

ASPX :

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title></title>

</

head>

<

body>

<form id="form1" runat="server">

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">

</telerik:RadScriptManager>

<div>

<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None"

Width="100%" AllowSorting="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated">

<MasterTableView CommandItemDisplay="Top">

<Columns>

<telerik:GridTemplateColumn DataField="Item" UniqueName="ItemColumn">

<ItemTemplate>

<asp:Label ID="Label1" runat="server"></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<telerik:RadComboBox ID="RadComboBox1" runat="server">

</telerik:RadComboBox>

</EditItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

</MasterTableView>

</telerik:RadGrid>

</div>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="RadGrid1">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="RadGrid1" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

</form>

</

body>

</

html>








.CS :

using

System;

using

System.Collections.Generic;

using

System.Linq;

using

System.Web;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Collections;

using

Telerik.Web.UI;

namespace

WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

{

ArrayList list = new ArrayList();

list.Add(

"string1");

list.Add(

"string2");

list.Add(

"string3");

RadGrid1.DataSource = list;

}

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)

{

if (e.Item.IsInEditMode == true && e.Item is GridEditableItem)

{

GridEditFormItem formItem = e.Item as GridEditFormItem;

GridTableRow tblRowForInsert = formItem["ItemColumn"].Parent as GridTableRow;

tblRowForInsert.Enabled =

false;

}

}

}

}





and in web.config  add the following lines in appsettings section :

<

appSettings>

<

add key="Telerik.Skin" value="Office2007"/>

<

add key="Telerik.Window.Skin" value ="Default"/>

</

appSettings>

0
Raj
Top achievements
Rank 1
answered on 08 Sep 2008, 06:19 PM
when add new record button is clicked, it shows the combobox with lower half cut.


Thanks -Raj
0
Sebastian
Telerik team
answered on 09 Sep 2008, 08:09 AM
Hello Raj,

Can you please check whether this issue appear with the Office2007 skin only and that you use the latest hotfix 2008.2.826 of RadControls for ASP.NET AJAX? I tried to reproduce the problem locally in a test project but unfortunately to no avail.

Furthermore, to progress in our investigation I suggest you either provide a live url (as implied previously) or prepare a stripped working version of your project and send it attached to a support ticket which you can start from your Client.NET account. Thus we will do our best to provide up-to-the-point explanation/fix.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Raj
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Raj
Top achievements
Rank 1
Share this question
or