启用第1行和第1行禁用gridview中的其余行 [英] Enable 1st row & disable rest of the rows in gridview

查看:71
本文介绍了启用第1行和第1行禁用gridview中的其余行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#在asp.net上工作。我有一个带有templatefield列的gridview。我在项目模板上有链接。最初只应启用gridview的第一行,其余行应禁用(所有行应该可见),



我的项目在预订床位对于病人,每个房间有4张病床。

病人1号,

病人2号,

病人3号,

患者4号

是我的gridview 4行,其中有适当的房间细节,我应该先预约患者1号,那时其余的行如2号病人,3号病人,4号病人不应该允许我当预订患者No1时,点击(书),

然后应该允许患者No2预订,其他行如No3,Patient No4不应该允许我点击(预订)等...



我的问题是如何启用行&当动作完成时禁用其余的行。



我已经通过了许多链接&尝试了,但到目前为止没有运气,因为我的条件似乎很复杂。为gridview编写的代码

Im working on asp.net with c#. I have a gridview with templatefield columns. I have link on the item template. Where initially only first row of the gridview should be enable, rest of the rows should be disable(all the rows should be visible),

My project is on booking beds for patients,where each room has 4 beds.
Patient No1,
Patient No2,
Patient No3,
Patient No4
are my gridview 4 rows with proper details of room,i should book Patient No1 first, and that time rest of the rows like Patient No2,Patient No3,Patient No4 shouldn't allow me click(book),
when Patient No1 is booked then Patient No2 should be allow to book and other rows like Patient No3, Patient No4 shouldn't allow me to click(book) so on...

My problem is how can i enable the row & disable rest of the rows when the action is completed.

I have gone through many links & tried also but so far no luck as my condition seems complicated.Coding written for gridview

<asp:TemplateField HeaderText="View Details">
    <ItemTemplate>
        <a href='Application.aspx?BedNo=<%# Eval("Pat_ID") %>'>                           View </a>
   </ItemTemplate>
</asp:TemplateField>



Plz帮助me。


Plz help me.

推荐答案

使用EditItemTemplate和ItemTemplate元素。将链接放在ItemTemplate中的EditItemTemplate和静态文本中。当选择行进行编辑时,链接将显示,而不会显示静态文本。

Use the EditItemTemplate along with the ItemTemplate elements. Put the link in the EditItemTemplate and static text in the ItemTemplate. When the row is selected for editing the link will show and when it's not the static text will show.
<asp:TemplateField HeaderText="View Details">
        <ItemTemplate>
            View
       </ItemTemplate>
        <EditItemTemplate>
            <a href='Application.aspx?BedNo=<%# Eval("Pat_ID") %>'>View</a>
       </EditItemTemplate>
    </asp:TemplateField>


这篇关于启用第1行和第1行禁用gridview中的其余行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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