通过Ajax级联下拉列表将querystring传递到Web服务. [英] Passing querystring to webservice through Ajax cascading dropdown.

查看:128
本文介绍了通过Ajax级联下拉列表将querystring传递到Web服务.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我如何从Web服务中的查询字符串中获取值.

解决方案

 <     ="  > ddlCollegeNameCascadingDropDown"    运行  ="    类别  ="   TargetControlID       LoadingText   正在加载区域中心..."  PromptText   -选择区域中心-"    PromptValue   ="     ServiceMethod   ="  BindRCdropdown"  ServicePath   ="  >>  <  /ajaxToolkit:CascadingDropDown  >>  


在后面的代码中使用ServiceMethod="BindRCdropdown"而不是像
这样的apx页面

 ddlCollegeNameCascadingDropDown.ServiceMethod = "  + Request.QueryString [" ]; 


在网络服务呼叫中获取您的QueryString

 strUGPG = HttpContext.Current.Request.QueryString [" ] .ToString().Trim();




谢谢


看看这个stackoverflow问题,它解释了您需要做什么,(Scott Anderson的回答)

http://stackoverflow.com/questions/2006828/possible-to-invoke-asmx-service-with-parameter-via-url-query-string [ http://www.techbubbles.com/wcf/wcf-and-rest/ [ ^ ]


Can any one tell me how can i get value from query string in web service.

解决方案

<ajaxToolkit:CascadingDropDown ID="ddlCollegeNameCascadingDropDown" runat="server" Category="RC" TargetControlID="ddlRC" LoadingText="Loading Regional Center..." PromptText="--Select Regional Center--" PromptValue="0" ServiceMethod="BindRCdropdown" ServicePath="../WebService/DropdownWebService.asmx"></ajaxToolkit:CascadingDropDown>


use ServiceMethod="BindRCdropdown" in code behind rather than apx page like

ddlCollegeNameCascadingDropDown.ServiceMethod = "BindCollegedropdown?CRS=" + Request.QueryString["CRS"];


in web service call to get your QueryString

strUGPG= HttpContext.Current.Request.QueryString["CRS"].ToString().Trim();




Thanks


Have a look at this stackoverflow question that explains what you need to do, (answer by Scott Anderson)

http://stackoverflow.com/questions/2006828/possible-to-invoke-asmx-service-with-parameter-via-url-query-string[^]

If you *really* need to allow HttpGet to your webservice, then you will be able to access the query string as in the example.

However, this does violate the pattern somewhat, if you need to allow HttpGet then consider creating a REST service, as per the accepted answer on that link

http://www.techbubbles.com/wcf/wcf-and-rest/[^]


这篇关于通过Ajax级联下拉列表将querystring传递到Web服务.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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