.cs code:
------------------
protected void dlpagelist_ItemDataBound( object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
{
LinkButton link = (LinkButton)e.Item. FindControl("lnkshowhide");
Table chtbl = (Table)e.Item.FindControl(" tblshowhide");
if ((link != null) && (chtbl != null))
{
string clickHandler = string.Format( "return changeColor('{0}');",chtbl. ClientID);
link.Attributes.Add("onclick", clickHandler);
}
}
}
javascript for show/hide :
------------------------------ ------
function changeColor(elementRef) {
if (document.getElementById( elementRef).style.display == "none")
{
document.getElementById( elementRef).style.display = "inline-table";
return false;
}
else
{
document.getElementById( elementRef).style.display = "none";
return false;
}
}
.aspx code for design:
------------------------------ ------
<asp:DataList ID="dlpagelist" runat="server" DataSourceID="ODSPageList" CellSpacing="2"
CellPadding="4" ForeColor="Black" Width="95%" OnItemDataBound="dlpagelist_ ItemDataBound">
<SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<HeaderTemplate>
<table width="100%">
<tr>
<td width="110px">
<asp:Label ID="lbldatamodified" runat="server" Text="Date modified"></asp:Label>
</td>
<td width="110px">
<asp:Label ID="lblipaddress" runat="server" Text="IP Address"></asp:Label>
</td>
<td width="110px">
<asp:Label ID="lbloptionchosen" runat="server" Text="Option Chosen"></asp:Label>
</td>
<td width="110px">
<asp:Label ID="lblname" runat="server" Text="Name"></asp:Label>
</td>
<td width="110px">
<asp:Label ID="lblsign" runat="server" Text="Sign"></asp:Label>
</td>
<td width="110px">
<asp:Label ID="Label3" runat="server" Text="User"></asp:Label>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="lnkshowhide" Text="Show/Hide" runat="server" CommandName="Select" />
<asp:Table id="tblshowhide" width="100%" border="1px" runat="server" bgcolor="white">
<%--<tr>
<td align="left" bgcolor="#FFFFFF" colspan="6">
<a href="#null">Show/Hide</a>
</td>
</tr>--%>
<asp:TableRow>
<asp:TableCell width="110px">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("sdate") %>'></asp:Label>
</asp:TableCell>
<asp:TableCell width="110px">
<asp:Label ID="Label4" runat="server" Text='<%# Eval( "ipaddress" ) %>'></asp:Label>
</asp:TableCell>
<asp:TableCell width="110px">
<asp:Label ID="Label5" runat="server" Text='<%# Eval( "r_option" ) %>'></asp:Label>
</asp:TableCell>
<asp:TableCell width="110px">
<asp:Label ID="Label6" runat="server" Text='<%# Eval( "name" ) %>'></asp:Label>
</asp:TableCell>
<asp:TableCell width="110px">
<asp:Label ID="Label7" runat="server" Text='<%# Eval( "sig" ) %>'></asp:Label>
</asp:TableCell>
<asp:TableCell width="110px">
<asp:Label ID="Label8" runat="server" Text='<%# Eval( "Login" ).ToString().Equals("null") ? "-" : Eval( "Login" ) %>'></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell colspan="6" align="left">
<b>Ad revision input:</b>
<asp:Label ID="lblsign" runat="server" Text='<%# Eval( "crv" ) %>'></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell colspan="6" align="left">
<b>Special notes:</b>
<asp:Label ID="Label1" runat="server" Text='<%# Eval( "spnote" ) %>'></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell colspan="6" align="left">
<b>Ad placement & size details:</b>
<asp:Label ID="Label9" runat="server" Text='<%# Eval( "rv" ) %>'></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell colspan="6" align="left">
<b>Approval Details:</b>
<asp:Label ID="Label10" runat="server" Text=""> </asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
<HeaderStyle BackColor="#999999" HorizontalAlign="Center" Font-Bold="True" ForeColor="White" />
<ItemStyle HorizontalAlign="Left" BorderStyle="Solid" BorderWidth="1px" BorderColor="#CCCCCC" />
<FooterTemplate>
<asp:Label ID="lblEmpty" Text="No Issue created" runat="server" ForeColor="Black"
BackColor="White" Visible='<%#bool.Parse(( dlpagelist.Items.Count==0). ToString())%>'> </asp:Label>
</FooterTemplate>
</asp:DataList>
No comments:
Post a Comment