-1

Im working on asp.net with c#. I have a gridview with templatefield columns, data comes from sql database. 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 help me..

4

2 回答 2

0

您可以使用 placeHolder 配置链接的外观可见性

我之前对此主题的回复: 根据列值将 DataGrid 列显示为超链接列

于 2013-09-02T08:47:05.980 回答
0

将 href 设置为 javascript:; 对于项目索引> 0 的所有其他行。

<asp:TemplateField HeaderText="View Details">
    <ItemTemplate>
        <a href='<%# Container.DataItemIndex==0 ? "javascript:;" :  "Application.aspx?BedNo=" + Eval("Pat_ID").ToString() %>'>                           View </a>
   </ItemTemplate>
</asp:TemplateField>
于 2013-09-02T08:49:12.110 回答