“System.Web.UI.WebControls.Repeater”不包含名称为“SelectedValue”的属性
我不确定我应该在 vb.net 项目后面的代码中编写什么。我有一个过滤网格视图的中继器。当尝试声明标量变量 @CompanyID 时,我收到了本文标题中提到的错误。有人可以帮助我吗?我尝试在许多论坛上寻找答案,但找不到正确的答案。
dsLetters.SelectCommand = "SELECT DISTINCT LEFT(ProductName, 1) AS [Letter]
FROM Product, CompanyLink, Company
WHERE Product.ProductID = CompanyLink.ProductID
AND CompanyLink.CompanyID = Company.CompanyID
AND Company.CompanyID = @CompanyID"
'declaring scalar variable @CompanyID
dsLetters.SelectParameters.Clear()
Dim cp As ControlParameter = New ControlParameter
cp.ControlID = "rptLetters"
cp.DefaultValue = "-1"
cp.Name = "CompanyID"
cp.PropertyName = "SelectedValue"
cp.Type = TypeCode.Decimal
dsLetters.SelectParameters.Add(cp)
I am not sure what I am supposed to write in the code behind for my vb.net project. I have a repeater that filters a gridview. When trying to declare the scalar variable @CompanyID, I get the error I mentioned in the title of this post. Can someone help me? I have tried to look for the answer on many forums, but I can't find the right answer.
dsLetters.SelectCommand = "SELECT DISTINCT LEFT(ProductName, 1) AS [Letter]
FROM Product, CompanyLink, Company
WHERE Product.ProductID = CompanyLink.ProductID
AND CompanyLink.CompanyID = Company.CompanyID
AND Company.CompanyID = @CompanyID"
'declaring scalar variable @CompanyID
dsLetters.SelectParameters.Clear()
Dim cp As ControlParameter = New ControlParameter
cp.ControlID = "rptLetters"
cp.DefaultValue = "-1"
cp.Name = "CompanyID"
cp.PropertyName = "SelectedValue"
cp.Type = TypeCode.Decimal
dsLetters.SelectParameters.Add(cp)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题在于中继器没有选定值的概念;他们所做的只是显示您所选择的内容。您可能需要做的是模仿隐藏下拉列表中的转发器值,并添加客户端代码以在下拉列表中选择适当的值,然后将 ControlParameter 绑定到此属性。
I think the issue is that repeaters don't have the concept of a selected value; all they do is show what you have selected. What you may need to do is mimic the repeater values in a hidden dropdownlist and add client-side code to choose the appropriate value in the dropdownlist, then bind your ControlParameter to this property.