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

Label Properties in CommandItem

2 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 05 Sep 2008, 06:33 PM
I'be been successfully setting up HyperLinks in the ItemCreated event but oddly I cant seem to simply set a label , when I do the following the label is always blank (the hyperlink works fine).$0$0$0$0$0  <CommandItemTemplate>$0$0                    $0$0$0       <asp:Label ID="lblAccount" runat="server" Text=""></asp:Label>$0$0             ...$0$0$0$0$0$0$0    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)$0$0    {$0$0        if (e.Item is GridCommandItem)$0$0        {$0$0            GridDataItem gridDataItem = e.Item as GridDataItem;$0$0$0$0$0            HyperLink editLink = e.Item.FindControl("NewStudent") as HyperLink;$0$0            editLink.Attributes["href"] = "/Administration/Admin-Registration-Insert.aspx?AccountCode=" + Request.QueryString["AccountCode"];$0$0$0$0$0            Label lblAccount = e.Item.FindControl("lblAccount") as Label;$0$0            lblAccount.Attributes["Text"] = "AccountCode : " + Request.QueryString["AccountCode"];$0$0$0$0$0        }$0$0    }$0$0$0

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Sep 2008, 05:31 AM
Hi David,


Try setting the label text directly.
 lblAccount.Text= "AccountCode : " + Request.QueryString["AccountCode"].ToString();

Thanks,
Princy


0
david
Top achievements
Rank 1
answered on 09 Sep 2008, 03:21 PM
Duh,$0$0$0$0thanks$0
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
david
Top achievements
Rank 1
Share this question
or