GridView RowDataBound中的AJAX下拉控件中出现问题 [英] getting problem in the AJAX Dropdown Control in GridView RowDataBound

查看:86
本文介绍了GridView RowDataBound中的AJAX下拉控件中出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在GridView中使用AJAX下拉控件时出现问题.

当我将AJAX Dropdown数据绑定到网格中时,出现以下错误

错误:"Unable to cast object of type ''AjaxControlToolkit.ComboBox'' to type ''System.Web.UI.WebControls.DropDownList''."

我的代码

Hi,

I am getting problem in the AJAX Dropdown Control when i using in the GridView.

When i bound AJAX Dropdown data into the grid, i am getting the below error

Error: "Unable to cast object of type ''AjaxControlToolkit.ComboBox'' to type ''System.Web.UI.WebControls.DropDownList''."

My Code

If e.Row.RowType = DataControlRowType.DataRow Then
            Dim drpTo As DropDownList = DirectCast(e.Row.FindControl("drpTo"), DropDownList)
            If drpTo IsNot Nothing Then
                drpTo.DataSource = dsVendorList
                drpTo.DataTextField = "name"
                drpTo.DataValueField = "Id"
                drpTo.DataBind()
            End If
        End If


这里的问题是什么?


What is the Problem Over Here?

推荐答案

正如您所说的,您可以控制AjaxControlToolkit.ComboBox
类型的控件
As it says, you have control of type AjaxControlToolkit.ComboBox
Dim drpTo As AjaxControlToolkit.ComboBox = DirectCast(e.Row.FindControl("drpTo"), AjaxControlToolkit.ComboBox)


这篇关于GridView RowDataBound中的AJAX下拉控件中出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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