0

I have a RadTextBox and I need my back-end to know the Text of it. However, I get an error when trying to access it from anywhere within my backend:

txtnote does not exist in the current context.

    <telerik:GridTemplateColumn HeaderText="Notes" UniqueName="Notes">
       <ItemTemplate>
          <telerik:RadTextBox ID="txtnote" InputType="Text" Width="100%" Rows="4" runat="server" Text='<%# Eval("notes")%>' TextMode="MultiLine"></telerik:RadTextBox>
       </ItemTemplate>
    </telerik:GridTemplateColumn>

Does anyone have any suggestions on how I can get the Text value of this?

  • Show the code behind. – trix Jun 14 '18 at 18:45
  • As mentioned above, I cannot access this from anywhere. My backend is completely empty, just an empty page_load method. – classicSchmosby98 Jun 14 '18 at 18:52
  • Check [this](https://stackoverflow.com/questions/7936544/findcontrol-in-gridtemplatecolumn-in-radgrid) out. – trix Jun 14 '18 at 19:07
  • 1
    If you have the ability try posting on their forums, they have good support. Only things I can suggest would be restart your IDE. I find Visual Studio and Telerik controls sometimes get into a funk. Do you have multiple versions of their WPF controls installed on the system? I've had issues where different versions of the software wouldn't play nicely together. – 580 Jun 14 '18 at 20:25
  • You are in a template of a data-bound control, so you can't directly access the server element in code-behind. There are lots of ways to get it though, you just have to search. Such as https://www.telerik.com/forums/accessing-new-value-from-textbox-in-itemtemplate-edititemtemplate-in-radgrid – Seano666 Jun 15 '18 at 15:59
  • I had restarted my Visual Studio several times, which did not change the situation. Thanks @Seano666 , this led me to a decent solution. – classicSchmosby98 Jun 18 '18 at 10:05

1 Answers1

1

Thanks to @Seano666, I found a solution. This is what I ended up using:

RadTextBox txtbox = (RadTextBox)item["Notes"].FindControl("txtnote");
string WhatIWantedToFind = txtbox.Text;

Thanks.