[Help] Can I write HeaderText of GridBoundColumn like this ??

3 posts, 0 answers
  1. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 30 Jan 2010 Link to this post

    <telerik:GridBoundColumn DataField="Username" HeaderText='<%= strUsername%>' UniqueName="Username"
    </telerik:GridBoundColumn> 


    My strUsername in cs file

            public string strUsername 
            { 
                get 
                { 
                    return "ABC"
                } 
            } 



    But when I run it return là null value in picture below :-s.
    Now how can I write like that


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 31 Jan 2010 Link to this post

    Hello,

    You can set the header text from code behind as shown below.

    CS:
     
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridHeaderItem) 
            { 
                GridHeaderItem headerItem = (GridHeaderItem)e.Item; 
                LinkButton literalControl = (LinkButton)headerItem["Username"].Controls[0]; 
                literalControl.Text = strUsername; 
            } 
        } 

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. VnDevil
    VnDevil avatar
    58 posts
    Member since:
    Oct 2012

    Posted 17 Feb 2010 Link to this post

    Thanks for help :) it work
Back to Top