Pa napravi svoju NumericTextBox kontrolu koja nasledjuje TextBox (pa samim tim i sve ostalo njegovo) ali exposuje i property Value, pa binduj taj property... ja sam za web pravio slicnu stvar... ne mozes da copy-pastujes ali mozes da steknes predstavu sigurno:
Code:
[DefaultProperty("Value"),
ToolboxData("<{0}:MoneyEditor runat=server></{0}:MoneyEditor>")]
public class MoneyEditor : System.Web.UI.WebControls.TextBox
{
#region Properties
private decimal controlValue = 0;
[Bindable(true),
Category("Appearance"),
DefaultValue("0")]
public override string Text
{
get
{
if (CurrencyDisplay)
return Value.ToString("C", new CultureInfo("en-US")).Remove(0, 1);
else
return Value.ToString("N"+decimalPlaces).TrimEnd('0').TrimEnd('.');
}
set
{
if (value.Trim() == "")
controlValue = 0;
else
controlValue = Convert.ToDecimal(value);
}
}
public decimal Value
{
get
{
return (decimal)controlValue;
}
set
{
controlValue = value;
}
}
private int decimalPlaces = 3;
[Bindable(true),
Category("Appearance")]
public int DecimalPlaces
{
get
{
return decimalPlaces;
}
set
{
decimalPlaces = value;
}
}
// ... itd itd...
Javi ako imas poteskoca...
.NET expert wanna-be
Ne citam PM :( => saljite mail