CheckBox中的内联代码(Inline code in CheckBox)

   IT问题网   2021-02-17 00:00:00

问 题

大家好,



我想设置带有内联代码的复选框已检查属性,如果可能请帮帮我。

我的代码是: -

 lt;   itemtemplate  gt;  
lt; a href =" #" nclick = " newwin('lt;% #eval(" userid =")%gt;');" gt; 查看lt; / a gt;
lt; asp:checkbox id =" chk1" runat =" server" 已检查 =' lt;% if (eval (" isapproved")==(object) 1 ){%gt; true lt;%;} else {%gt; false lt;%;}%gt;' autopostback =" true" / gt;
lt; / itemtemplate gt;




我是得到错误: -

无法从字符串表示''lt;%if(eval("isapproved")==创建''system.boolean''类型的对象(对象)1){%gt;对于"已检查"属性,为truelt;%;} else {%gt; falselt;%;}%gt;''。

解决方案

以这种方式尝试。



lt; itemtemplategt; 
lt; a href ="#"nclick="newwin(''lt;%#eval("userid =")%gt;'');"gt;查看lt; / agt;
lt; asp:checkbox id ="chk1"runat ="server"checked ="lt;%#(convert.toboolean(eval("isapproved"))?true:false)%gt;" autopostback ="true"xmlns:asp ="#unknown"/gt;
lt; / itemtemplategt;
lt; asp:templatefield xmlns:asp ="#unknown"gt;lt; / asp:templatefieldgt;


这将完成这项工作。

我提供了类似的这里

标签:中的内联代码



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

class structure.Net oops(class structure.Net oops)

problem 1.what is the difference between clas ...

手动添加服务引用(Manually add a service reference)

problem hello all, currently i am working on a web site ...

arraylist到memorystream c#(arraylist to memorystream c#)

problem hiii all... i have an arraylist with user define ...

在DispatchMessage崩溃,为什么?(Crash in DispatchMessage, why)

problem hi, dear all: i have a worker thread which have ...

导出HTML内容以打开办公室应用程序时出现问题。(Problem when export an HTML content to open office application.)

problem hello all. i am facing a problem when i am tryin ...

将数据从CSV导入Oracle(Importing Data from CSV to Oracle)

problem hi i want to import the data from csv to oracle, ...

如何使用存储过程传递id(how to pass id for where using stored procedure)

problem how to pass id for where condition when using mys ...

使用cookie值加载gridview(Load gridview using a cookie value)

problem i have a method to load a gridview according to a ...

只有添加足够的行才能启用垂直滚动条,才会显示ClistBox(ClistBox doesn't display until enough lines are added to enable the vertical scroll bar)

problem i have an application that adds lines to a list b ...

DateTime数据类型的算术运算。(Arithmetic Operations on DateTime Datatype.)

problem hi, i have been trying to find a way to do arit ...

将图像插入Word(Insert Image to Word)

problem how to compress inserted image in word using dsof ...

我如何缩进给定的XML(how can i indent a given XML)

problem is there any easiest way to indent given xml i ...

我想将Outlook消息保存到sql server db(i want to save outlook messages to sql server db)

problem hi could you please help me on saving outlook m ...

我如何在cookie中保存令牌(how I can save the token in the cookie)

problem hi, i am creating the web service au ...

C#.net中的ModalPopupExtender(ModalPopupExtender in C#.net)

problem while i am clicking the modal popup extender wind ...

需要帮助来更改密码表格(need help to change password form)

problem hi everyone, i am still newbie in vb. ...

CMap或CMapPtrToPtr(CMap or CMapPtrToPtr)

problem hi, i want store the objects in cmap ...

如何创建新的任务栏(how to create new task bar)

problem hi, i want to create new taskbar,can any one hel ...

在C#.net中旋转PDF文件(Rotate PDF File in C#.net)

problem hi , how to rotate pdf file in c#.net ...

在C#.Net中旋转图像文件(Rotate Image Files in C#.Net)

problem hi, how to rotate image files(jpeg,ti ...