在asp.net的gridview中有条件地单击模板字段 [英] conditional click of template field in gridview in asp.net

查看:66
本文介绍了在asp.net的gridview中有条件地单击模板字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用c#在asp.net中创建一个CRM网站,因为这需要编辑客户投诉.

在ComplaintActions.aspx的一页中,我有一个gridview,其中显示了迄今为止的所有投诉,在该gridview中,我有三个模板字段编辑",删除",邮件"投诉,现在我正在执行的操作是编辑投诉点击,我只是将整个投诉数据重定向到了一个javascript弹出窗口..像这样..

Hi everyone,

I am making a CRM website in asp.net using c#, in this i have a requirement for editing customer complaints.

In one page ComplaintActions.aspx i have one gridview in which i display all the complaints to date, and also in that gridview i have three template fields "Edit" , "Delete", "Mail" complaints, now what i have done is on Edit complaint click i have simply redirected the whole complaint data to a javascript popup.. like this..

<asp:TemplateField HeaderText="Edit Complaint">
                                  <ItemTemplate >
                                    <a href="javascript:Openpopup('EditComplaint.aspx?ComplaintId=<%# Eval("ComplaintId") %>&CompNo=<%#Eval("ComplaintNumber") %>&CompTitle=<%# Eval("ComplaintTitle") %>&CompDesc=<%# Eval("ComplaintDescription") %>&SchName=<%# Eval("SchoolName") %>&Zn=<%# Eval("ZoneName") %>&Zm=<%# Eval("ZonalManager") %>&RpDate=<%# Eval("ReportedDate") %>&CmpStatus=<%# Eval("ComplaintStatusId") %>&DtOfClosure=<%# Eval("ComplaintClosedDate") %>&NoOfDays=<%# Eval("NumberOfDays") %>&EngName=<%# Eval("EngineersName") %>')">
                                      <asp:Label ID="Label1" runat="server" Text="Edit"></asp:Label>
                                  </ItemTemplate>
                                  <ItemStyle Width="100px" />
                              </asp:TemplateField>



现在,我需要的是如果投诉已关闭,则编辑投诉模板字段不应重定向到EditComplaint.aspx弹出页面.

我不想在此使用RowCommand事件...请对此提供帮助...

谢谢&问候,
Krunal Panchal



Now what i need is the edit complaint template field should not redirect to EditComplaint.aspx popup page if the complaint is already closed...

I dont want to use RowCommand event in this... Please help me regarding this...

Thanks & Regards,
Krunal Panchal

推荐答案

亲爱的

使用下面的函数,然后在单击href或链接按钮时调用它.

hi dear

Use function like below and call it on click of your href or link button.

function openNewWindow(Path, isAllow) {
            try {
                if (isAllow.trim() != "" && parseInt(isAllow) != 0) {
                    var width = 400;
                    var height = 430;
                    var left = parseInt((screen.availWidth / 2) - (width / 2));
                    var top = parseInt((screen.availHeight / 2) - (height / 2));
                    var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
                    window.open(Path, "_Blank", windowFeatures)
                }
            }
            catch (e) {
                return false;
            }
            return false;
        }



现在在gridviewcolumn中调用



now call in gridviewcolumn

<dx:gridviewdatabinaryimagecolumn caption="More Info" visible="true" fieldname="Pending OD" xmlns:dx="#unknown">
                                                           <dataitemtemplate>
                                                               <a href="javascript:void(0);" onclick="return openNewWindow('../Transactions/popup.aspx?&id=','<%#Eval(" id=") %>',,'<%#Eval(" isallow=")%>');">
                                                                   <asp:label id="Label2" runat="server" text="More Info" tooltip="Click Here To More Info" xmlns:asp="#unknown"></asp:label>
                                                               </a>
                                                           </dataitemtemplate>
                                                       </dx:gridviewdatabinaryimagecolumn>




谢谢




Thanks


这篇关于在asp.net的gridview中有条件地单击模板字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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