locked
Create FilteredTextBoxExtender in ListView RRS feed

  • Question

  • User1510859543 posted

    Is it possible to dynamically remove a FilteredTextBoxExtender at runtime?  I have one in a ListView and when I try to export the html of the listview I get an error so I would like to dynamically remove it while exporting.  Thanks.

    Sunday, February 16, 2014 5:43 PM

All replies

  • User-933407369 posted

    Can you please explain what you are trying to do in detail?

    I couldn't understand your question. The title of thread and question is conflicting.

    if you want to Create FilteredTextBoxExtender, you can check out the link below:

    adding programatically FilteredTextBoxExtender

    http://forums.asp.net/t/1592568.aspx

    if you want to remove it while exporting, you need to find FilteredTextBoxExtender control in code-behind, then remove it from ListView:

    using AjaxControlToolkit;

    ListViewItem item  = ddlReason.NamingContainer as ListViewItem;
     FilteredTextBoxExtendertbox = item.FindControl("txtOtherReason") as FilteredTextBoxExtender;

    Hope it helps you.

    Monday, February 17, 2014 6:15 AM
  • User1510859543 posted

    Yes, I want to have the FilteredTextBoxExtender removed when I export the ListView but then re-created when the user goes back into edit or insert mode.  I could not find a "Visible" property so I thought that was my only choice.  Am I correct?

    Monday, February 17, 2014 8:07 AM
  • User-933407369 posted

    No, i don't agree with you.As usual we replace "Visible" property with 'dipaly:none' , for example:

      <div style="display:none" >
    <asp:TextBox ID="TextBox1" runat="server" /> <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TextBox1" FilterType="Numbers" /></div>

    check out codes above, you can hide your FilteredTextBoxExtender control.

    Of course you can also hide them by code behind, add the style for them Dynamicly.

    Hope it can inspire you. if it is not helpful , you can post the complete  markup or provide a simple demo,which can easily reproduce the problem.

    Thank you for your understanding.

    Tuesday, February 18, 2014 4:14 AM
  • User1510859543 posted

    I tried this concept before but it didn't work because the export process still found the control and threw an error. If I set visible to False then the export of the ListView worked great.

    Tuesday, February 18, 2014 8:24 AM
  • User-933407369 posted

    Can you post the complete  markup or provide a simple demo,which can easily reproduce the problem ?

    i want to have a try and  help you find solution.

    Thursday, February 20, 2014 5:39 AM