我正在使用水晶报表在数据库中打印数据。我想将下拉值作为参数传递给数据库。但是我的代码给出了一个错误,说输入字符串的格式不正确。以下是我的代码示例。
这是我的HTML代码。
<div class="col-sm-7">
<select kendo-drop-down-list
name="PaymentCategory"
class="k-fill"
ng-init="Init()"
ng-model="ReceiptCancelWF.PaymentCategory"
k-placeholder="'Select Payment Category'"
k-data-text-field="'text'"
k-data-text-field="'Value'"
k-data-value-field="'Key'"
k-data-source="PaymentCategoryDropdown"
ng-disabled="ReceiptCancelWF.AllPayCat"></select>
</div>
这是我的前端代码。
$scope.PaymentCategoryDropdown = [
{ "text": "Select", "value": 0 },
{ "text": "AR", "value": 1 },
{ "text": "CB", "value": 4 },
];
$scope.PrintEntry = function (form) {
var PaymentCategory = $scope.ReceiptCancelWF.PaymentCategory;
PrintService.OpenPrint('POST', appConfig.REPORT_URL + 'CPOSReportViewer.aspx', { type: "ReceiptCancellationWF", PaymentCategory: PaymentCategory},'_blank'
};
这是我的后端代码。
myReport.Load(Server.MapPath("~/CPOSReport/MIS/CancellationReports/ReceiptCancellationWorkFlow.rpt"));
myReport.SetParameterValue("@EntryType", Convert.ToInt32(Request.Form["PaymentCategory"]));
我想将value属性作为整数传递给数据库。
答案 0 :(得分:0)
我明白了。我更改了我的html代码和最终代码,如下所示。
<div class="col-sm-7">
<select kendo-drop-down-list
name="PaymentCategory"
class="k-fill"
ng-init="Init()"
ng-model="ReceiptCancelWF.PaymentCategory"
k-placeholder="'Select Payment Category'"
k-data-text-field="'text'"
k-data-value-field="'value'"
k-data-source="PaymentCategoryDropdown"
ng-disabled="ReceiptCancelWF.AllPayCat"></select>
$scope.PaymentCategoryDropdown = [
{ "text": "Select", "value": "0" },
{ "text": "AR", "value": "1" },
{ "text": "CB", "value": "4" },
];