I want to filter DFWP through asp:TextBox.
Using Office Designer I added DFWP with data to the page. Added asp:textbox with runat server, autopostback and ID="textBoxSearch". Created variable [var] in DFWP and in the source section chose element textBoxSearch.
Then added filter "field_1 contains [var]".
This search(filter) worked greatly for two weeks, then filter broken. Only recreating DFWP helped. After another week filter was broken. Any text in textbox was ignored by filter.
I figured out that SP can't see asp:textbox "textBoxSearch" in variable [var], because if change "contains [var]" to "contains 'some text'" it will work.
How can it be - working some time, then accidentally not?
If not using internal filter web-part, but textbox, how to fix it?
I found that SP looks to property Text of asp:TextBox and to non existing property Value. It will be changed after IIS reset. So, when SP looks to Value filter does not work.
The answer is two write your own control ascx CustomTextBox based on asp:TextBox.
Don't forget that you can't copy usual codebehind files to SP.
First, write full codebehind file and compile it to DLL(I called it SearchTextBox.dll):
Then assign this DLL with keys and insert to the server GAC (or give special rights).
After that you can link the assemble with public key in ascx control file (without codebehind files). NewTextBox.ascx file:
Copy NewTextBox.ascx to ...\12\TEMPLATE\CONTROLTEMPLATES\
Control NewTextBox.ascx is ready to use. We just need to register it in SP page:
And insert it to this page: