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

[Solved] Skin

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
naveen veda
Top achievements
Rank 1
naveen veda asked on 10 Jul 2009, 09:06 AM
Hi,

I used RadGrid asp.net for ajax and two radio button is there in my form , when i click  the radio button the skin is not applaying for Radgird control for the first time(page load) after refresh the grid the skin is working fine what was the problem?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Jul 2009, 11:01 AM
Hi naveen veda,

The provided information is not enough for us to guess what is happening.

In case you are using asp:UpdatePanels, then use Telerik RadAjaxManager, which is able to update the <head> of the page and register new CSS files after an AJAX request.

Here is a simple web page, which works as expected:

<%@ Page Language="C#" %> 
<%@ Import Namespace="System.Data" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<script runat="server"
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.Visible = true
        RadGrid1.Rebind(); 
    } 
 
    protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) 
    { 
        DataTable dt = new DataTable(); 
        DataRow dr; 
        int colsNum = 5
        int rowsNum = 10
        string colName = "Column"
 
        for (int j = 1; j <= colsNum; j++) 
        { 
            dt.Columns.Add(String.Format("{0}{1}", colName, j)); 
        } 
 
        for (int i = 1; i <= rowsNum; i++) 
        { 
            dr = dt.NewRow(); 
 
            for (int k = 1; k <= colsNum; k++) 
            { 
                dr[String.Format("{0}{1}", colName, k)] = String.Format("{0}{1} Row{2}", colName, k, i); 
            } 
            dt.Rows.Add(dr); 
        } 
 
        (sender as RadGrid).DataSource = dt
    } 
     
</script> 
 
<!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"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="Button1"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
<asp:Button ID="Button1" runat="server" Text="AJAX" OnClick="Button1_Click" /> 
 
<asp:Panel ID="Panel1" runat="server"
    <telerik:RadGrid 
        ID="RadGrid1" 
        runat="server" 
        Visible="false" 
        Skin="Office2007" 
        OnNeedDataSource="RadGrid_NeedDataSource" /> 
</asp:Panel> 
 
</form> 
</body> 
</html> 


Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
naveen veda
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or