Last post Feb 20, 2014 05:39 AM by Happy Chen - MSFT
Feb 16, 2014 05:43 PM|dlchase|LINK
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.
Feb 17, 2014 06:15 AM|Happy Chen - MSFT|LINK
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
if you want to remove it while exporting, you need to find FilteredTextBoxExtender control in code-behind, then remove it from ListView:
ListViewItem item = ddlReason.NamingContainer as ListViewItem;
FilteredTextBoxExtendertbox = item.FindControl("txtOtherReason") as FilteredTextBoxExtender;
Hope it helps you.
Feb 17, 2014 08:07 AM|dlchase|LINK
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?
Feb 18, 2014 04:14 AM|Happy Chen - MSFT|LINK
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" />
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.
Feb 18, 2014 08:24 AM|dlchase|LINK
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.
Feb 20, 2014 05:39 AM|Happy Chen - MSFT|LINK
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.