I have a simple condition and want to implement it with ?:
keyword but compiler do't let me. this is the exact sample
// in asp page decleration
<ajaxtoolkit:FilteredTextBoxExtender id="ftbeNumeric" runat="server" TargetControlID="textbox1" FilterType="Numbers" />
<asp:TextBox ID="textbox1" runat="server" />
// in code behind
decimal x = textbox1.Text != string.IsNullOrEmpty ? Convert.ToDecimal(textbox1.Text) : 0;
I also try this
// in code behind
decimal x = Convert.ToDecimal(textbox1.Text) != 0 ? Convert.ToDecimal(textbox1.Text) : 0;
bith of these sample face with error.
how to define this with ?:
keyword? and note that textbox
.text` may be null.