More in this section

Forums / Bugs & Issues / RadGridView null inside a custom user control

RadGridView null inside a custom user control

2 posts, 0 answered
  1. Paolo
    Paolo avatar
    147 posts
    11 Jun 2009
    19 May 2011
    Link to this post
    I'm writing a custom control and got problem with a null value for the RadGridView (and also others controls)
    Here's my ascx :

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SearchPage.ascx.cs"
        Inherits="SitefinityWebApp.SearchPage" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
    <%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit"
        Assembly="Telerik.Sitefinity" %>
    <div id="itemsContainer" runat="server">
    <asp:Label runat="server" Text="prova" ID="jason"></asp:Label>
        <telerik:RadGrid runat="server" ID="gvResult" AutoGenerateColumns="false">
                    <telerik:GridBoundColumn UniqueName="FileName" DataField="Title">
                    <telerik:GridBoundColumn UniqueName="DateCreated" DataField="DateCreated">
                    <telerik:GridBoundColumn UniqueName="FileName" DataField="Title">

    and here's the cs:

    public partial class SearchPage : System.Web.UI.UserControl
           private string queryString = string.Empty;
           private bool searchTagOnly = false;
           protected void Page_Load(object sender, EventArgs e)
               if (Request.Params["query"] != null)
                   queryString = Request.Params["query"];
               if (Request.Params["tag"] != null)
                   searchTagOnly = Convert.ToBoolean(Request.Params["tag"]);

    when I do

    gvResult.DataSource = result; <- gvResult is null and also this.Controls has 0 items...

    Why this happen?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    23 May 2011
    Link to this post
    Hello Paolo,

    Thanks for the code, but it doesn't show where you create and set value of the "result" . Can you show how you set this value?

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered