Archive for November, 2008

Default values for FormView control in Insert mode
November 19, 2008In many times we must assign default values to FormView in the insert mode. Problem is, that FW creates empty entity and this means empty FW.
Here is very short and powerful solution
- Add binding source to control which we want to set
<
asp:TextBox ID=”RateTextBox” runat=”server” Text=’<%# Bind(“Rate”) %>‘ TabIndex=”24″ MaxLength=”5″ OnDataBinding=”InsertRateOnDataBinding“ /> - Setting value to this control
protected
void InsertRateOnDataBinding(object sender, EventArgs e)
{
((TextBox) sender).Text = RevertedOccupiedPercentage.ToString();
}

Regex designer tool
November 4, 2008
If you want to design and test your regular expressions, you should find any power utility. There is one – Free Regular Expression Designer.
Links

Percentage Regex
November 3, 2008If you need percentage regex for positive percent numbers, you can use this:
- ^0?[0-9]{0,2}(\,[0-9]{1,2})?$|^(100)(\,[0]{1,2})?$
Valid values: 100; 13,1; 001; 002,11; 100; 000; 0
Invalid values: 15.1; 15,x; 101; -2; -0