Aspx source file
<% @ Page Language = "C #" codebehind = "radionj_list.aspx.cs" autoeventwireup = "false" inherits = "Radio. Radio. radionj_list" %>
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> NJ list </title>
<Meta name = "generator" content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "code_language" content = "C #">
<Meta name = "vs_defaultclientscript" content = "JavaScript">
<Meta name = "vs_targetschema" content = "http://schemas.microsoft.com/intellisense/ie5">
<Link href = "admin/style/item.css" type = "text/CSS" rel = "stylesheet">
<Style>
. Normal
{
Font-weight: normal
}
. Bigsize
{
Font-weight: bold;
}
<! -- Asthlon published in 05 3-25 -->
</Style>
</Head>
<Body ms_positioning = "gridlayout"> <! -- <Table border = "0" cellspacing = "0" cellpadding = "0">
</Table> -->
<Form ID = "form1" method = "Post" runat = "server">
<Div align = "center">
<Asp: datalist id = "info_data" runat = "server" showfooter = "false" gridlines = "both" bordercolor = "control"
Repeatcolumns = "2" repeatdirection = "horizontal" horizontalalign = "center" showheader = "false"
Cellpadding = "5" borderwidth = "0px" repeatlayout = "flow">
<Itemstyle horizontalalign = "center" Height = "120px" width = "140px" verticalalign = "Middle"> </itemstyle>
<Itemtemplate>
<Table cellspacing = "0" cellpadding = "0">
<Tr>
<TD> </TD>
<TD valign = "Middle" bgcolor = "# fecc00" align = "center"> <a href = '<% # databinder. eval (container. dataitem, "ID", "radio_nj_info.aspx? Id = {0} ") %> '>
<Div style = "overflow: hidden; width: 90px; Height: 90px;"> '> </div>
</A>
</TD>
<TD> </TD>
</Tr>
</Table>
</Itemtemplate>
</ASP: datalist>
<Div style = "padding-left: 40px"> <font color = "#000000"> total
<Asp: Label id = "list_num" runat = "server"> </ASP: Label> records </font>
<Asp: Label id = "list_at" runat = "server"> </ASP: Label> <font color = "#000000"> & nbsp; </font> <asp: linkbutton id = "P0" runat = "server" commandname = "P0"> <font face = "webdings"> 9 </font> </ASP: linkbutton>
<Asp: linkbutton id = "p1" runat = "server" commandname = "p1">
<Font face = "webdings"> 7 </font> </ASP: linkbutton>
[<Asp: placeholder id = "p_pagelist" runat = "server"> </ASP: placeholder>]
<Asp: linkbutton id = "p2" runat = "server" commandname = "p2">
<Font face = "webdings"> 8 </font> </ASP: linkbutton>
<Asp: linkbutton id = "P3" runat = "server" commandname = "P3">
<Font face = "webdings" >:</font> </ASP: linkbutton>
<! --
& Nbsp; <asp: textbox id = "attxt" onkeyup = "this. value = This. value. replace (// D/g, '')" runat = "server" width = "35px"
Onafterpaste = "this. value = This. value. replace (// D/g, '')"> </ASP: textbox> <asp: button id = "go_to" runat = "server" text = "go"> </ASP: button>
-->
</Div>
</Div>
</Form>
</Body>
</Html>
. Cs source file
Using system;
Using system. collections;
Using system. componentmodel;
Using system. Data;
Using system. Data. sqlclient;
Using system. drawing;
Using system. Web;
Using system. Web. sessionstate;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. htmlcontrols;
Namespace Radio. Radio
{
/// <Summary>
/// Asthlon is published in 05 3-25.
/// </Summary>
Public class radionj_list: system. Web. UI. Page
{
Protected system. Web. UI. webcontrols. datalist info_data;
Protected system. Web. UI. webcontrols. Label list_num;
Protected system. Web. UI. webcontrols. Label list_at;
Protected system. Web. UI. webcontrols. linkbutton P0;
Protected system. Web. UI. webcontrols. linkbutton P1;
Protected system. Web. UI. webcontrols. linkbutton P2;
Protected system. Web. UI. webcontrols. placeholder p_pagelist;
Protected system. Web. UI. webcontrols. linkbutton P3;
Private void page_load (Object sender, system. eventargs E)
{
If (! Ispostback)
{
Webuse. sqlec. Database ditem = new webuse. sqlec. Database ();
String SQL = "select count (ID) from radio_dj ";
Viewstate ["curpage"] = 0;
Viewstate ["pcount"] = ditem. strsql_txtsql (SQL );
Bind_list ();
Post_control ();
}
Else
{
Post_control ();
}
// Place user code here to initialize the page
}
Private void bind_list ()
{
Int psize = 10;
Int sindex, Len,;
Float F;
Webuse. sqlec. Database ditem = new webuse. sqlec. Database ();
Len = convert. toint32 (math. Ceiling (convert. toint32 (viewstate ["pcount"])/psize); // + 1
F = convert. tosingle (viewstate ["pcount"])/psize;
If (F> convert. toint32 (convert. toint32 (viewstate ["pcount"])/psize ))
{
Len = Len + 1;
}
Sindex = convert. toint32 (viewstate ["curpage"]) * psize;
Sqldataadapter ADP = new system. Data. sqlclient. sqldataadapter ();
Dataset DS = new dataset ();
ADP = ditem. read_adapter_noarg ("radio_dj_sel"); // ditem. read_adapter_txtsql (SQL );
ADP. Fill (DS, sindex, psize, "show ");
Info_data.datasource = Ds;
Info_data.databind ();
At = convert. toint32 (viewstate ["curpage"]);
If (at <= 0)
{
Required enabled = false;
P1.enabled = false;
}
Else
{
P1.enabled = true;
Required enabled = true;
}
If (at> = len-1)
{
P2.enabled = false;
P3.enabled = false;
}
Else
{
P2.enabled = true;
P3.enabled = true;
}
List_num.text = convert. tostring (viewstate ["pcount"]);
List_at.text = convert. tostring (sindex/psize + 1) + "/" + Len. tostring ();
Clear_linkbutton_style ();
}
Private void go_page (Object sender, system. Web. UI. webcontrols. commandeventargs E)
{
String CommonName;
Int sindex = convert. toint32 (viewstate ["curpage"]);
Int Len = convert. toint32 (math. Ceiling (convert. toint32 (viewstate ["pcount"])/10 ));
CommonName = E. commandname;
Switch (partition name)
{
Case "P0 ":
Sindex = 0;
Break;
Case "p1 ":
Sindex-= 1;
Break;
Case "p2 ":
Sindex + = 1;
Break;
Case "P3 ":
Sindex = Len;
Break;
}
Viewstate ["curpage"] = sindex;
Bind_list ();
}
Private void post_control ()
{
Int I;
Int Len = convert. toint32 (math. Ceiling (convert. toint32 (viewstate ["pcount"])/10 ));
Float F = convert. tosingle (viewstate ["pcount"])/10;
If (F> convert. toint32 (convert. toint32 (viewstate ["pcount"])/10 ))
{
Len = Len + 1;
}
This. p_pagelist.controls.clear ();
String S = "";
// Int curpage = convert. toint32 (viewstate ["curpage"]);
For (I = 1; I <= Len; I ++)
{
System. Web. UI. webcontrols. linkbutton lkbtn = new linkbutton ();
S = "" + I. tostring () + "";
Lkbtn. Text = s;
Lkbtn. commandargument = I. tostring ();
This. p_pagelist.controls.add (lkbtn );
Lkbtn. Command + = new commandeventhandler (lkbtn_command );
}
}
Private void clear_linkbutton_style ()
{
Int curpage = convert. toint32 (viewstate ["curpage"]) + 1;
Foreach (control ictrl in this. p_pagelist.controls)
{
If (ictrl. GetType (). tostring (). toupper (). indexof ("linkbutton")> 0)
{
Linkbutton ilkbtn = (linkbutton) ictrl;
If (ilkbtn. commandargument. tostring () = curpage. tostring ())
{
Ilkbtn. cssclass = "bigsize ";
}
Else
{
Ilkbtn. cssclass = "normal ";
}
}
}
}
Private void lkbtn_command (Object sender, system. Web. UI. webcontrols. commandeventargs E)
{
Int GOS, sindex;
Int Len = convert. toint32 (math. Ceiling (convert. toint32 (viewstate ["pcount"])/10 ));
If (E. commandargument = NULL)
{
Return;
}
Sindex = 0;
GOS = convert. toint32 (E. commandargument );
// Clear_linkbutton_style ();
// Linkbutton lkbtn = (linkbutton) sender ;//
// Lkbtn. cssclass = "bigsize ";
If (GOS <= 0)
{
Sindex = 0;
}
Else
{
If (GOS> = Len + 1)
{
Sindex = Len;
}
Else
{
Sindex = gos-1;
}
}
Viewstate ["curpage"] = sindex;
Bind_list ();
}
/**
Private void go_to_click (Object sender, system. eventargs E)
{
Int GOS, sindex;
Int Len = convert. toint32 (math. Ceiling (convert. toint32 (viewstate ["pcount"])/9 ));
If (attxt. Text = "")
{
Return;
}
Sindex = 0;
GOS = convert. toint32 (attxt. Text );
If (GOS <= 0)
{
Sindex = 0;
}
Else
{
If (GOS> = Len + 1)
{
Sindex = Len;
}
Else
{
Sindex = gos-1;
}
}
Viewstate ["curpage"] = sindex;
Bind_list ();
}
**/
/// <Summary>
/// Obtain NJ Entertainment Information
/// </Summary>
/// <Param name = "T"> </param>
/// <Param name = "I"> </param>
/// <Returns> </returns>
Public String return_nj_detail (string T, int I)
{
String rstr = NULL;
String [] istr = T. Split (',');
Rstr = istr [I];
Return rstr;
}
# Code generated by region web Form Designer
Override protected void oninit (eventargs E)
{
//
// Codegen: This call is required by the ASP. NET web form designer.
//
Initializecomponent ();
Base. oninit (E );
}
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void initializecomponent ()
{
This. Configure command + = new system. Web. UI. webcontrols. commandeventhandler (this. go_page );
This. p1.command + = new system. Web. UI. webcontrols. commandeventhandler (this. go_page );
This. p2.command + = new system. Web. UI. webcontrols. commandeventhandler (this. go_page );
This. p3.command + = new system. Web. UI. webcontrols. commandeventhandler (this. go_page );
This. Load + = new system. eventhandler (this. page_load );
}
# Endregion
}
}