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

Find RadInput control in form View

2 Answers 50 Views
Input
This is a migrated thread and some comments may be shown as answers.
sayitfast
Top achievements
Rank 2
Iron
sayitfast asked on 16 Sep 2008, 04:13 AM
I'm trying to set a radTextBox's text to the value of cookie... but I keep getting an error that Object is not set to reference of an object. 

Little help!

using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.IO;  
using System.Collections.Specialized;  
using System.Drawing;  
using Telerik.WebControls;  
 
 
public partial class UserArticleDetails : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
          
    }  
    protected void FormView1_PreRender1(object sender, EventArgs e)  
    {  
        if (this.FormView1.CurrentMode == FormViewMode.Insert)  
        {  
            //This works  
            TextBox txtName1 = this.FormView1.FindControl("txtName") as TextBox;  
            txtName1.Text = "test";  
 
            //This does not work  
            TextBox radName = this.FormView1.FindControl("radTextBox1") as TextBox;  
            radName.Text = "hello";  
        }  
    } 

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 16 Sep 2008, 04:10 PM
Hello Rhett,

Maybe you mean:
//This works   
TextBox txtName1 = this.FormView1.FindControl("txtName"as TextBox; 
txtName1.Text = "test"
 
//This does not work   
RadTextBox radName = this.FormView1.FindControl("radTextBox1"as RadTextBox; 
radName.Text = "hello";   

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
sayitfast
Top achievements
Rank 2
Iron
answered on 16 Sep 2008, 09:10 PM
Doh!!!  Thanks....

Rhett
Tags
Input
Asked by
sayitfast
Top achievements
Rank 2
Iron
Answers by
Daniel
Telerik team
sayitfast
Top achievements
Rank 2
Iron
Share this question
or