如何使用jquery的更改函数获取所选值的DropDown计数 [英] how to get the Count for DropDown on Selected value using Change Function of jquery

查看:72
本文介绍了如何使用jquery的更改函数获取所选值的DropDown计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Hello Team,
我有以下实体框架。

在DataManger.cs
我有如下代码。
public IEntityBase GetQCCount(IEntityBase entityBase)
{
IDataReader dataReader = null;
IQCAllocation qcallocation = null;
try
{
Logger.Write(Inside QBpoDataManager.GetQCCount(),LogType.Information);
qcallocation = entityBase as IQCAllocation;

string query =select count(ID)as Customerloandata with Count(nolock),其中qcuserid =+ qcallocation.AllocateToQC +AND isnull(QCPROCESSED,0)= 0 AND isnull(QCTOVERIFY,0 )= 1和isnull(删除,0)= 0和STATE ='+ qcallocation.State +'和batchid =+ qcallocation.BatchId +;
CommonDataAccess.CreateSqlStringCommandWrapper(string.Format(query));

dataReader = CommonDataAccess.ExecuteReader();
while(dataReader.Read())
{
qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
qcallocation.Count = dataReader [QBpoConstants.COUNT] .ObjectToInt32();
}

Logger.Write(退出QBpoDataManager.GetQCCount(),LogType.Information);
}
catch(异常异常)
{
抛出异常;
}
最后
{
dataReader.CloseDataReader();
}

返回qcallocation;
}

In(BusinessManager)QbpoManager.cs
我的代码如下:
public Result GetQCCount(IEntityBase entityBase)
{
结果result = null;
try
{
result = new Result();
Logger.Write(Inside DashboardManagerRead.GetQCCount(),LogType.Information);
QBpoDataManager qbpoDataManager = new QBpoDataManager();
result.Entity = qbpoDataManager.GetQCCount(entityBase);
Logger.Write(Exiting DashboardManagerRead.GetQCCount(),LogType.Information);
}
catch(异常异常)
{
exception.HandleException(Global.CONSTSTREXCPOLICYBUSINESS);
}

返回结果;
}

在UI Controller.cs
我的代码如下:
public Result GetQCCount(IEntityBase entityBase)
{

结果result = null;
if(this.qbpoManager!= null)
{
result = this.qbpoManager.GetQCCount(entityBase);
}
返回结果;
}

在QCAllocationASPX.cs
我的代码如下:

[WebMethod]
public static string GetQCCount(object allocateQCCountDetails )
{
string resultMessage = string.Empty;
结果result = null;
IQCAllocation qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
尝试
{
qcallocation = allocateQCCountDetails.ConvertToJsonString()。JsonToObject(qcallocation.GetType())as IQCAllocation;
DisplayDEOIDCount = QbpController.GetQCCount(qcallocation).Entity.ConvertToJsonString();

if(result!= null&& result.Error.GetCount()> 0)
{
resultMessage = result.Error.GetAll();
}

}
catch(异常异常)
{
resultMessage = string.Format(技术错误发生。{0}。请联系系统管理员。,exception.Message);
}

返回DisplayDEOIDCount;
}

在QcAllocation.ASPX页面
我写了Jquery如下:

< td>
< label id =allocateToQCCountLabel>
QC数量:
< / label>
< / td>

var GetQCCount;

函数allocateQCEntity(){
var allocateQC = cloneObject(blankQCAllocationEntity);
allocateQC.TopCountForQC = $('#topCountForQCTextbox')。val();
allocateQC.AllocateToQC = $(#allocateToSelect option:selected)。val();
返回allocateQC;
}

函数GetCountForQCQC(){
debugger;
var qcCountEntity = allocateQCEntity();
$ .ajax({
url:'QCAllocation.aspx / AllocateToQC',
类型:'POST',
contentType:'application / json; charset = utf-8' ,
dataType:json,
data:'{allocateQCCountDetails:'+ JSON.stringify(qcCountEntity)+'}',
成功:函数(结果){
调试器;
if(result.d!=''){
GetQCCount = JSON.parse(result.d);
$('#allocateToQCCountLabel')。text(GetQCCount .Count ).val(GetQCCount .Count);
}
},

错误:函数(错误){
manageOverlay(false);
alert( error.responseText);
},
async:false
});

};

不要担心这段代码,因为这段代码对我有用。
我想为
执行一项任务< td>
< select id =allocateToSelectclass =combo150>

< / select>
< / td>


在Dropdown中我得到的值为:DEO1
DE02
DE03

在更改事件时,如果我选择其中一个来自DropDown的id,我想要特定用户的QCCount即(DE01,DE02,DE03)。
如何在Change Function Jquery上获取它。
请指导我。
谢谢
Harshal

解决方案

('#topCountForQCTextbox')。val();
allocateQC.AllocateToQC =


(#allocateToSelect option:selected)。val();
返回allocateQC;
}

函数GetCountForQCQC(){
debugger;
var qcCountEntity = allocateQCEntity();


.ajax({
url:'QCAllocation.aspx / AllocateToQC',
type:'POST',
contentType:'application / json; charset = utf-8',
dataType:json,
data:'{allocateQCCountDetails:'+ JSON.stringify(qcCountEntity)+' }',
成功:函数(结果){
调试器;
if(result.d!=''){
GetQCCount = JSON.parse(result.d);

Hello Team,
I have the Entity Framework as follows.

In DataManger.cs
I have the code as follow.
 public IEntityBase GetQCCount(IEntityBase entityBase)
        {
            IDataReader dataReader = null;
            IQCAllocation qcallocation = null;
            try
            {
                Logger.Write("Inside QBpoDataManager.GetQCCount()", LogType.Information);
                qcallocation = entityBase as IQCAllocation;

                string query = "select count(ID) as Count from Customerloandata with (nolock) where qcuserid = " + qcallocation.AllocateToQC + " AND isnull(QCPROCESSED,0) = 0 AND isnull(QCTOVERIFY,0) = 1 and isnull(deleted,0) = 0 and STATE = '" + qcallocation.State + "' and batchid = " + qcallocation.BatchId + " ";
                CommonDataAccess.CreateSqlStringCommandWrapper(string.Format(query));

                dataReader = CommonDataAccess.ExecuteReader();
                while (dataReader.Read())
                {
                    qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
                    qcallocation.Count = dataReader[QBpoConstants.COUNT].ObjectToInt32();
                }

                Logger.Write("Exiting QBpoDataManager.GetQCCount()", LogType.Information);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                dataReader.CloseDataReader();
            }

            return qcallocation;
        }

In (BusinessManager)QbpoManager.cs
I have the code as follow:
public Result GetQCCount(IEntityBase entityBase)
        {
            Result result = null;
            try
            {
                result = new Result();
                Logger.Write("Inside DashboardManagerRead.GetQCCount()", LogType.Information);
                QBpoDataManager qbpoDataManager = new QBpoDataManager();
                result.Entity = qbpoDataManager.GetQCCount(entityBase);
                Logger.Write("Exiting DashboardManagerRead.GetQCCount()", LogType.Information);
            }
            catch (Exception exception)
            {
                exception.HandleException(Global.CONSTSTREXCPOLICYBUSINESS);
            }

            return result;
        }

In UI Controller.cs
I have the code as follows:
 public Result GetQCCount(IEntityBase entityBase)
        {

            Result result = null;
            if (this.qbpoManager != null)
            {
                result = this.qbpoManager.GetQCCount(entityBase);
            }
            return result;
        }

In QCAllocationASPX.cs 
I have the code as follows:

 [WebMethod]
        public static string GetQCCount(object allocateQCCountDetails)
        {
            string resultMessage = string.Empty;
            Result result = null;
            IQCAllocation qcallocation = QBpoEntityCreator.GetQCAllocationEntity();
            try
            {
                qcallocation = allocateQCCountDetails.ConvertToJsonString().JsonToObject(qcallocation.GetType()) as IQCAllocation;
                DisplayDEOIDCount = QbpController.GetQCCount(qcallocation).Entity.ConvertToJsonString();

                if (result != null && result.Error.GetCount() > 0)
                {
                    resultMessage = result.Error.GetAll();
                }

            }
            catch (Exception exception)
            {
                resultMessage = string.Format("Technical error ocurred. {0}. Please contact to system administrator.", exception.Message);
            }

            return DisplayDEOIDCount;
        }

In QcAllocation.ASPX page
I have written the Jquery as follows:

 <td>
                        <label id="allocateToQCCountLabel">
                            QC Count :
                        </label>
                    </td>

var GetQCCount ;

 function allocateQCEntity() {
            var allocateQC = cloneObject(blankQCAllocationEntity);
            allocateQC.TopCountForQC = $('#topCountForQCTextbox').val();
            allocateQC.AllocateToQC = $("#allocateToSelect option:selected").val();
            return allocateQC;
        }

        function GetCountForQCQC() {
            debugger;
            var qcCountEntity = allocateQCEntity();
            $.ajax({
                url: 'QCAllocation.aspx/AllocateToQC',
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                dataType: "json",
                data: '{"allocateQCCountDetails":' + JSON.stringify(qcCountEntity) + '}',
                success: function (result) {
                    debugger;
                    if (result.d != '') {
                        GetQCCount = JSON.parse(result.d);
                        $('#allocateToQCCountLabel').text(GetQCCount .Count).val(GetQCCount .Count);
                    }
                },

                error: function (error) {
                    manageOverlay(false);
                    alert(error.responseText);
                },
                async: false
            });

        };

 Dont get worry for this code ,as this code is working for me.
I want to perform one task for 
<td>
                        <select id="allocateToSelect" class="combo150">

                        </select>
                    </td>


In Dropdown i am getting the Value as:DEO1 
                                      DE02 
                                      DE03

On change Event,if i select one of the id from DropDown, i want QCCount for particular User ie (DE01,DE02,DE03).
How to get it on Change Function Jquery.
Please guide me .
Thanks
Harshal

解决方案

('#topCountForQCTextbox').val(); allocateQC.AllocateToQC =


("#allocateToSelect option:selected").val(); return allocateQC; } function GetCountForQCQC() { debugger; var qcCountEntity = allocateQCEntity();


.ajax({ url: 'QCAllocation.aspx/AllocateToQC', type: 'POST', contentType: 'application/json; charset=utf-8', dataType: "json", data: '{"allocateQCCountDetails":' + JSON.stringify(qcCountEntity) + '}', success: function (result) { debugger; if (result.d != '') { GetQCCount = JSON.parse(result.d);


这篇关于如何使用jquery的更改函数获取所选值的DropDown计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆