我的问题是关于c# [英] My Question is about c#

查看:75
本文介绍了我的问题是关于c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写这段代码来生成动态链接按钮...所有的事情都是工作正确...但是当我在此行设置commandAgrument value..error时会出现问题

编辑。 CommandArgument = edit.CommandArgument'< #Eval(CourseCode)>';

I write this code to generate dynamic link button ...All thing is work correclty..but problem occur when i set the commandAgrument value..error at this line
edit.CommandArgument=edit.CommandArgument'<#Eval("CourseCode")>';



 class LinkButtonColumn : ITemplate
    {
        public void InstantiateIn(System.Web.UI.Control container)
    {
        LinkButton edit = new LinkButton();
        edit.Text = "Edit";
        edit.CommandName = "Edit";
            edit.CommandArgument=edit.CommandArgument'<#Eval("CourseCode")>';
        edit.ID = "btn_edit";
        container.Controls.Add(edit);
    }
    }











任何人帮我?






any one help me ??

推荐答案

属性 LinkBut​​ton.CommandArgument 是字符串类型:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.commandargument%28v=vs.110%29.aspx [<一个href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.commandargument%28v=vs.110%29.aspxtarget =_ blanktitle =New窗口> ^ ]。



''标记中的任何内容都不能是字符串;它可能是一个角色,但它会无效。



我看不出你的 Eval 背后有任何合理的想法。它适用于ASP.NET?然后请阅读此CodeProject文章并参考MSDN文章: Eval的邪恶( )在ASP.NET 中[ ^ ]。



-SA
The property LinkButton.CommandArgument is of the string type:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.commandargument%28v=vs.110%29.aspx[^].

Anything in '' marks cannot be a string; it could be a character, but it would be invalid.

I cannot see any reasonable idea behind your Eval. It it for ASP.NET? Then please read this CodeProject articles and referenced MSDN articles: The Evil of Eval() in ASP.NET[^].

—SA


这篇关于我的问题是关于c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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