如何根据条件在gridview中启用链接按钮 [英] How to Enable a link button in gridview based on condition

查看:73
本文介绍了如何根据条件在gridview中启用链接按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,





我有一个gridview,其中包含UserID,Task,TaskType,ReminderDate,TaskStatus等列。 />


现在我输入UI中的值,我给出了userID,Task,TaskType(每周,每月,每年,今天)和提醒日期..
$ b当提醒日期与系统日期(今天的日期)匹配时,$ b

我需要在TaskStatus列中启用一个链接按钮,提到它为待定。



我已经完成了linkbutton的编码,完成了从会话和系统日期注册ID的任务。



我想知道当提醒日期与系统日期匹配时如何启用链接按钮..



另外我需要当提醒日期与gridview中的系统日期(今天的日期)匹配时,使用相同的userID,Task,TaskType更新一行,但应根据用户给出的任务类型更改提醒日期..它应自动发生(以编程方式)没有任何用户的互动。



请进一步指导我。

解决方案

首先你的检查日期数据库和这个字段creare数据类型是咬,并在这之后放置网格视图代码



  <   asp:TemplateField     HeaderText   = & nbsp; ||& nbsp; Electoral Roll& nbsp; | |& nbsp; >  
< ItemTemplate >
< asp:ImageButton ID = btn_form 可见 =' <% #Eval( emp_electoral_no%> ' runat = server < span class =code-attribute>

< span class =code-attribute> < span class =code-attribute> ImageUrl = 〜/ Images / Site / print_icon.png OnCommand = grd_form_RowCommand CommandArgument =' <% #Container.DataItemIndex %> '

< span class =code-attribute> 样式 = margin-left: 38px; / >
< / ItemTemplate >
< / asp:TemplateField >


我可以使用Enabled属性。如何进行。有什么问题让我知道... 

< asp:LinkBut​​ton ID = LinkBut​​tonExport 文字 = 导出到Excel runat = server OnClick = LinkBut​​tonExport_Click / >


Hello Experts,


I have a gridview that has columns like UserID,Task,TaskType,ReminderDate,TaskStatus .

and now i enter the values from UI where i give userID,Task,TaskType(weekly,monthly,yearly,today)and Reminder Date..

when the reminder date is matched with system date(today's date) i need to enable a link button in TaskStatus column mentioning it as "Pending".

I have done the coding for linkbutton to finish the task which registers the ID from session and system date.

I want to know how to enable the linkbutton when the reminder date is matched with system date..

Also i need to update a row when reminder date is matched with system date(today's date) in gridview with the same userID,Task,TaskType but the reminder date should be changed as per the task type given by the user.. it should happen automatically(programmatically) without any interaction from the user.

Please guide me further.

解决方案

first your check date in database and this field creare datatype is bite and after put grid view code like this

<asp:TemplateField HeaderText="&nbsp;||&nbsp;Electoral Roll&nbsp;||&nbsp;">
                            <ItemTemplate>
                                <asp:ImageButton ID="btn_form" Visible='<%#Eval("emp_electoral_no")%>' runat="server"

                                    ImageUrl="~/Images/Site/print_icon.png" OnCommand="grd_form_RowCommand" CommandArgument='<%#Container.DataItemIndex %>'

                                    Style="margin-left: 38px;" />
                            </ItemTemplate>
                        </asp:TemplateField>


I thing using Enabled property we can do. How to proceed. Is there any problem let me know...

<asp:LinkButton ID="LinkButtonExport" Text="Export to Excel" runat="server" OnClick="LinkButtonExport_Click" />


这篇关于如何根据条件在gridview中启用链接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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