Getting an error when I try to get control of radgrid edit template text box in code behind. I want to make edit template textbox "visible = false" when insert click(Add new record). Anybody can help me?
protected void ItemCommand(object sender, GridCommandEventArgs e)
if (e.CommandName == RadGrid.InitInsertCommandName)
(this.Page.FindControl("txtOpcode") as RadTextBox).Visible = false;
//(RadGrid1.MasterTableView.FindControl("txtOpcode") as RadTextBox).Visible = false;
Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
7 Answers, 1 is accepted
You can find the TextBox in ItemDataBound Event.Try the following code snippet.
Please go through the following documentation for more information .
Its working now
I have some other issues related to this post. I posted it in my other thread. We can communicate there. Please answer for that thread.
Thank you again
I'm receiving the exact same error that Ben received (Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.) but my situation is slightly different.
I have a custom edit form, and within the edit form I have RadAsyncUpload and RadBinaryImage conrols. Where I'm receiving the error is when I try to upload a new image. When I debug, the line of code that's creating the error is where I'm trying to find the RadBinaryImage control in my edit form. See code below:
File Upload Method (bold = where error is thrown):
My RadGrid is contained in a Master Page. How can I get at my "Thumbnail" control?
You can try the following code snippet to access the RadBinaryImage in edit form.
I'm using Telerik Grid and binded an XML through dataset. I've a autyo generate edit coulmn.
When I press edit, I get a text box with exisitng value and update, cancel button. After typing new value whren i press am not getting the new value in the grid. Can any one help on this. I'm using updatecommand event,but no use so far. Here is my code
Hashtable newValues = new Hashtable();
GridEditableItem editItem = (GridEditableItem)e.Item;
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
var obj = editItem.GetDataKeyValue("ConnectionString");
//TextBox txt = e.Item.FindControl("txtValue") as TextBox;
//if (txt != null)
// string s = txt.Text;
ds.Tables["add"].Rows[editItem.DataSetIndex] = "XXXXX";
//radDisplay.DataSource = ds.Tables["add"];
StringWriter sw = new StringWriter();
Session["decryptesXMLString"] = sw.ToString();
I have tried the same and that worked as expected. One suggestion is to try the following approach to achieve the same.