获取asp.net radiobuttonlist listitem的null值

时间:2016-07-29 09:11:30

标签: c# asp.net

我有这个RadioButtonList

<asp:RadioButtonList runat="server" ID="loanTypeCheck" CssClass="pull-right" RepeatDirection="Horizontal">
    <asp:ListItem Value="Cash" Text="&nbsp;&nbsp;Cash&nbsp;&nbsp;"/>
    <asp:ListItem Value="Non-Cash" Text="&nbsp;&nbsp;Non-Cash&nbsp;&nbsp;" />
    <asp:ListItem Value="Dharauti" Text="&nbsp;&nbsp;Dharauti&nbsp;&nbsp;" />                           
</asp:RadioButtonList>

在我的保存按钮事件中的代码隐藏

protected void SaveButton_Click(object sender, EventArgs e)
    {
        if (IsFormValidForSave())
        {
            var loanReceipt = GetLoanReceiptFromForm();
            var transactionsDetails = new List<TransactionDetail>();
            var loantypeCheck = loanTypeCheck.SelectedValue;
            //if (IsCashReceipt)
            if (loantypeCheck == "Cash")
            {
                var transaction = new Transaction()
                {
                    AuditUserId = UserId,
                    OfficeId = OfficeId,
                    VerificationStatusId = 0,
                    BookName = EverestEnums.TransactionBookName.LoanReceipt,
                    BookNameString = EverestEnums.TransactionBookName.LoanReceipt.ToString(),
                    TranDateString = DateConversion.GetCurrentServerDate().ToString(),
                    ValueDateString = ValueDateControl.ValueDateAd.ToString(),
                    TellerId = UserId,
                    TotalAmount = SubmittedAmountTextBox.Text.ToDecimal(),
                    ValueDate = ValueDateControl.ValueDateAd,
                    TranDate = DateConversion.GetCurrentServerDate(),
                };

我收到单选按钮的空值。我错过了什么?

0 个答案:

没有答案