[cid:image001.png@01CC9A15.3FB5EDE0]Hi all,
I've taken my image gallery web part to the next level and moved all properties 
to an EditorPart class. Everything looks great and works nicely provided all 
properties have a value.
I have the following four properties which correspond to the screenshot.

*         oListName

*         SelectedColumn

*         ImgBeginsWith

*         AscDesc
However, I want the Filter field (ImgBeginsWith) to be optional, so that all 
items are returned when it's empty.
This was working fine before I recreated this property as a TextBox within the 
EditorPart section.
ImgFilter = new TextBox();
ImgFilter.TextMode = TextBoxMode.SingleLine;
ImgFilter.Text = string.Empty;
ImgFilter.CssClass = "UserInput";
ImgFilter.ToolTip = "Leave blank to return all images.";
panListSettings.Controls.Add(ImgFilter);
In my web part I then have:
public string _imgBeginsWith = string.Empty;

[WebBrowsable(false),
        Personalizable(PersonalizationScope.Shared)]
public string ImgBeginsWith
{
    get {
        if (_imgBeginsWith == string.Empty)
        {
           _imgBeginsWith = "";
       }
        return _imgBeginsWith;
    }
    set { _imgBeginsWith = value; }
}
And then I check it every way I know how here:

if (ImgBeginsWith != null && SPEncode.HtmlEncode(ImgBeginsWith) != string.Empty 
&& !string.IsNullOrEmpty(ImgBeginsWith))
{
    oQuery.Query = "<Where><BeginsWith><FieldRef Name=\"FileLeafRef\"/>"
        + "<Value Type=\"File\">" + ImgBeginsWith + 
"</Value></BeginsWith></Where>";
}
else
{
    oQuery.Query = "<Where><IsNotNull><FieldRef Name=\"FileLeafRef\"/>"
        +  "<Value Type=\"File\"></Value></IsNotNull></Where>";
}


Yet it ALWAYS runs the first query option!

Any help please?!?

<<inline: image001.png>>

_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to