顯示具有 ListView 標籤的文章。 顯示所有文章
顯示具有 ListView 標籤的文章。 顯示所有文章

2014年7月13日 星期日

[RESOLVED] Listview


How do I limit the number of rows per page in a listview



inside layout template of listview, add datapage tab as below


set pagesize in datapager tag







hope this helps...



If you're using a datapager, you can do something like shown below:


<asp:DataPager ID="myPager" runat="server" PagedControlID="Your ListView Id"
PageSize=
"5">


[RESOLVED] Listview


How do I limit the number of rows per page in a listview



inside layout template of listview, add datapage tab as below


set pagesize in datapager tag







hope this helps...



If you're using a datapager, you can do something like shown below:


<asp:DataPager ID="myPager" runat="server" PagedControlID="Your ListView Id"
PageSize=
"5">


[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] EntityDataSource + GridView not updating and/or deleting!


Hello everybody.


I am trying to use EntityDataSource with GridView and take advantage of its "automatic query generation" feature. 


According to the MSDN docs: "The ListViewFormViewDetailsView,
and 
GridView Web server controls provide automatic read, insert, update, and delete functionality when used with anEntityDataSource control."


After few experiments, while reading data works fine, I can't get Update and Delete to work. 


Please take a look at the code I wrote:


ASPX: http://pastebin.com/svy0yvev


CodeBehind: http://pastebin.com/VHG9Jc0G



Basically, I can see the table with my data. I can see the Edit and Delete buttons. If I click the Delete link, the page reloads and nothing happens. If I click the Edit link, I switch to Edit mode. However, when I press the Update link, the page reloads
and nothing happens. 


I can see the _RowEditing, _RowUpdating and _RowDeleting events are fired. However, I never get to _RowUpdated or _RowDeleted.


Should not EntityDataSource take care of executing the low-level queries? Why is this not happening?


Thanks all for your help!


Cheers,


Gianluca.



For the entity datasource you will need a primary key for the table.it allows you to change the records...i think you may be missed setting of primary key .


Refer bellow post


http://stackoverflow.com/questions/13425270/aspentitydatasource-failing-to-update-or-delete-gridview



[RESOLVED] Display an Image


I want to display the image saved in the database in the listview.........i have applied my of the working codes and also watched videos but nothing works...just display an empty page.....now don't know what to do........please help me.


also tried with generic handler but failed



Hi,


This should definitely work for you,


http://www.dotnetcurry.com/ShowArticle.aspx?ID=175


Hope this helps!




still not working........help me......give me the code whichis tested



still not working.......give me the code which is tested......i want the code for list view........database is fetching but not the images




Hi,


If you store image path in the database, you can use imageField like this



For detailed information, you can refer here


http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx


http://www.codeproject.com/Articles/20782/Displaying-Images-from-a-Database-in-a-GridView


And if it doesn't work for you, you should check if the image path is right.


And refer the thread


http://highoncoding.com/Articles/166_Displaying_Images_in_a_GridView.aspx


Hope it can help you 



thanx........finally got implimented..........



[RESOLVED] Invalid postback or callback argument. Event validation is enabled using &lt;pages enableEventValidation=&quot;true&quot;












<%-- --%>

<%-- --%>











<%--

--%>







using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
DataTable Slip_DataTable = new DataTable();

public void DataBindSlip()
{
var result = from posts in Slip_DataTable.AsEnumerable()
// where posts.Field("BettingSlipNr") == optionalSlipMenu.SelectedValue
select new
{
BettingSlipNr = posts.Field("BettingSlipNr"),
};

ListView1.DataSource = result;
ListView1.DataBind();

}

protected void Page_Load(object sender, EventArgs e)
{
Slip_DataTable.Columns.Add(new DataColumn("BettingSlipNr"));

DataBindSlip();
}

protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "DeleteEvent")
{
Response.Redirect("22.aspx");
}
}

protected void Button1_Click(object sender, EventArgs e)
{
Slip_DataTable.Rows.Add(new object[] { "1" });

DataBindSlip();
}
}

I got Invalid postback or callback argument. ?



Please help





Please set enable page enableeventvailidation ="false"



hi
programercek
,


This type issue come when using griedview or listview data control with customized


for this load you list view on page load 


use :


if !(ispostback) {


load hear your listview


other way is that enableeventvalidation="false"


but is this is not a best way to use be'c  validation is neccessary for page


}



Hi,


Your code works well in my machine. Can you explain your question in details? Thanks.


[RESOLVED] pass values to usercontrol in listview selectedItem template


Hi All: I have a listview with a usercontrol in the itemTemplate and SelectedItemTemplate.


I need to pass some values to the usercontrol in the selectedItem template, but when I try to do it in the selectedIndexChanging event, the usercontrol doesn't display them. Am I passing the values to the usercontrol too early or too late in the page cycle?


Or do I need to do this in the itemdatabound event instead?


My selectedItem template looks like:

























Ship To: Bill To:












and in my codebehind:


    Protected Sub lv_selecting(sender As Object, e As ListViewSelectEventArgs) Handles listView1.SelectedIndexChanging
Dim lvRow As ListViewItem = CType(listView1.Items(e.NewSelectedIndex), ListViewItem)

Dim ta As New dsReceiptTableAdapters.receiptTableAdapter
Dim dt As New dsReceipt.receiptDataTable
ta.Fill(dt, userID)

Dim addST As address = CType(lvRow.FindControl("addressST"), address)
Dim addBT As address = CType(lvRow.FindControl("addressBT"), address)

If dt.Rows.Count > 0 Then
addST.fName = dt(0).stFname
addST.lName = dt(0).stLname
addST.company = dt(0).stCompany
addST.add1 = dt(0).stAdd1
addST.add2 = dt(0).stAdd2
addST.city = dt(0).stCity
addST.state = dt(0).stState
addST.zip = dt(0).stZip
addST.country = dt(0).stCountry
addST.phone = dt(0).stPhone
addBT.fName = dt(0).btName
addBT.add1 = dt(0).btAdd1
addBT.city = dt(0).btCity
addBT.state = dt(0).btState
addBT.zip = dt(0).btZip
addBT.country = dt(0).btCountry
addBT.phone = dt(0).btPhone
End If
End Sub









hi,


you can give your usercontrol value in itemdatabound event , such as following .


Protected Sub ListView1_ItemDataBound(sender As Object, e As ListViewItemEventArgs)
If e.Item.ItemType = ListViewItemType.DataItem Then
Dim addST As address = CType(lvRow.FindControl("addressST"), address) Dim addBT As address = CType(lvRow.FindControl("addressBT"), address)

...
End If
End Sub

Hope this helps


[RESOLVED] How to Save the ViewState of a ListView


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Drawing;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data;


public partial class About : System.Web.UI.Page
{
protected string numberOfRecords = "1500"; // number of items being displayed
protected string connString = ConfigurationManager.ConnectionStrings["lotto"].ConnectionString; // store connection string
protected string sproc = "[GetValue]";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (HttpContext.Current.Items["page"] != null)
{
lblpageNumber.Text = Server.HtmlDecode(HttpContext.Current.Items["page"].ToString());
}

if (Session["numberOne"] != null)
{
txtOne.Text = Session["numberOne"].ToString();
}
if (Session["numberTwo"] != null)
{
txtTwo.Text = Session["numberTwo"].ToString();
}
if (Session["numberThree"] != null)
{
txtThree.Text = Session["numberThree"].ToString();
}
if (Session["numberFour"] != null)
{
txtFour.Text = Session["numberFour"].ToString();
}
if (Session["numberFive"] != null)
{
txtFive.Text = Session["numberFive"].ToString();
}
if (Session["numberSix"] != null)
{
txtSix.Text = Session["numberSix"].ToString();
}
populateListView(lblpageNumber.Text, numberOfRecords, sproc);
//reset pager links
link1.Text = "";
link2.Text = "";
link3.Text = "";
link4.Text = "";
link5.Text = "";
link6.Text = "";
link7.Text = "";
link8.Text = "";
link9.Text = "";

link1.BackColor = System.Drawing.Color.Transparent;
link2.BackColor = System.Drawing.Color.Transparent;
link3.BackColor = System.Drawing.Color.Transparent;
link4.BackColor = System.Drawing.Color.Transparent;
link5.BackColor = System.Drawing.Color.Transparent;
link6.BackColor = System.Drawing.Color.Transparent;
link7.BackColor = System.Drawing.Color.Transparent;
link8.BackColor = System.Drawing.Color.Transparent;
link9.BackColor = System.Drawing.Color.Transparent;

customPager.Visible = false;



populateCustomPager(Server.HtmlEncode(lblpageNumber.Text));


}
}

protected void LottoList_databound(object sender, EventArgs e) // give everyting to sproc
{
foreach (ListViewDataItem item in LottoList.Items)
{
Label lblNumberOne = (Label)item.FindControl("numberOne");
Label lblNumberTwo = (Label)item.FindControl("numberTwo");
Label lblNumberThree = (Label)item.FindControl("numberThree");
Label lblNumberFour = (Label)item.FindControl("numberFour");
Label lblNumberFive = (Label)item.FindControl("numberFive");
Label lblNumberSix = (Label)item.FindControl("numberSix");


if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtThree.Text == lblNumberThree.Text && txtFour.Text == lblNumberFour.Text) // 1 2 3 4
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFour.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtThree.Text == lblNumberThree.Text && txtFive.Text == lblNumberFive.Text) // 1 2 3 5
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtThree.Text == lblNumberThree.Text && txtSix.Text == lblNumberSix.Text) // 1 2 3 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text) // 1 2 4 5
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtFour.Text == lblNumberFour.Text && txtSix.Text == lblNumberSix.Text) // 1 2 4 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtFive.Text == lblNumberFive.Text && txtSix.Text == lblNumberSix.Text) // 1 2 5 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberTwo.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFive.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtThree.Text == lblNumberThree.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text) // 1 3 4 5
{
lblNumberOne.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberThree.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFive.Font.Bold = true;
lblNumberFour.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtThree.Text == lblNumberThree.Text && txtFour.Text == lblNumberFour.Text && txtSix.Text == lblNumberSix.Text) // 1 3 4 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberThree.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtThree.Text == lblNumberThree.Text && txtFive.Text == lblNumberFive.Text && txtSix.Text == lblNumberSix.Text) // 1 3 5 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberThree.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberThree.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFive.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtFour.Text == lblNumberFour.Text && lblNumberFive.Text == txtFive.Text && txtSix.Text == lblNumberSix.Text) // 1 4 5 6
{
lblNumberOne.ForeColor = Color.Green;
lblNumberFour.ForeColor = Color.Green;
lblNumberFive.ForeColor = Color.Green;
lblNumberSix.ForeColor = Color.Green;
lblNumberFour.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberFive.Font.Bold = true;
lblNumberSix.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && lblNumberThree.Text == txtThree.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text) // 1 2 3 4 5
{
lblNumberOne.ForeColor = Color.Yellow;
lblNumberTwo.ForeColor = Color.Yellow;
lblNumberThree.ForeColor = Color.Yellow;
lblNumberFour.ForeColor = Color.Yellow;
lblNumberFive.ForeColor = Color.Yellow;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberFive.Font.Bold = true;

}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && lblNumberThree.Text == txtThree.Text && txtFour.Text == lblNumberFour.Text && lblNumberSix.Text == txtSix.Text) // 1 2 3 4 6
{
lblNumberOne.ForeColor = Color.Yellow;
lblNumberTwo.ForeColor = Color.Yellow;
lblNumberThree.ForeColor = Color.Yellow;
lblNumberFour.ForeColor = Color.Yellow;
lblNumberSix.ForeColor = Color.Yellow;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberSix.Font.Bold = true;

}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && lblNumberThree.Text == txtThree.Text && txtFive.Text == lblNumberFive.Text && lblNumberSix.Text == txtSix.Text) // 1 2 3 5 6
{
lblNumberOne.ForeColor = Color.Yellow;
lblNumberTwo.ForeColor = Color.Yellow;
lblNumberThree.ForeColor = Color.Yellow;
lblNumberFive.ForeColor = Color.Yellow;
lblNumberSix.ForeColor = Color.Yellow;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberSix.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text && lblNumberSix.Text == txtSix.Text) // 1 2 4 5 6
{
lblNumberOne.ForeColor = Color.Yellow;
lblNumberTwo.ForeColor = Color.Yellow;
lblNumberFour.ForeColor = Color.Yellow;
lblNumberFive.ForeColor = Color.Yellow;
lblNumberSix.ForeColor = Color.Yellow;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberSix.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}
if (txtOne.Text == lblNumberOne.Text && lblNumberThree.Text == txtThree.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text && lblNumberSix.Text == txtSix.Text) // 1 3 4 5 6
{
lblNumberOne.ForeColor = Color.Yellow;
lblNumberThree.ForeColor = Color.Yellow;
lblNumberFour.ForeColor = Color.Yellow;
lblNumberFive.ForeColor = Color.Yellow;
lblNumberSix.ForeColor = Color.Yellow;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberSix.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}

if (txtOne.Text == lblNumberOne.Text && txtTwo.Text == lblNumberTwo.Text && lblNumberThree.Text == txtThree.Text && txtFour.Text == lblNumberFour.Text && txtFive.Text == lblNumberFive.Text && lblNumberSix.Text == txtSix.Text) // 1 2 3 4 5 6
{
lblNumberOne.ForeColor = Color.Red;
lblNumberTwo.ForeColor = Color.Red;
lblNumberThree.ForeColor = Color.Red;
lblNumberFour.ForeColor = Color.Red;
lblNumberFive.ForeColor = Color.Red;
lblNumberSix.ForeColor = Color.Red;
lblNumberTwo.Font.Bold = true;
lblNumberOne.Font.Bold = true;
lblNumberThree.Font.Bold = true;
lblNumberFour.Font.Bold = true;
lblNumberSix.Font.Bold = true;
lblNumberFive.Font.Bold = true;
}

}
}
protected void btnSave_Click(object sender, EventArgs e)
{

}


protected void populateListView(string pageNumber, string records , string sproc)
{
LottoList.DataSourceID = "sqlLotto";
sqlLotto.ConnectionString = connString;
sqlLotto.SelectParameters["pageNumber"].DefaultValue = pageNumber;
sqlLotto.SelectParameters["pageSize"].DefaultValue = records;
sqlLotto.SelectParameters["numberOne"].DefaultValue = Server.HtmlEncode(txtOne.Text);
sqlLotto.SelectParameters["numberTwo"].DefaultValue = Server.HtmlEncode(txtTwo.Text);
sqlLotto.SelectParameters["numberThree"].DefaultValue = Server.HtmlEncode(txtThree.Text);
sqlLotto.SelectParameters["numberFour"].DefaultValue = Server.HtmlEncode(txtFive.Text);
sqlLotto.SelectParameters["numberFive"].DefaultValue = Server.HtmlEncode(txtFive.Text);
sqlLotto.SelectParameters["numberSix"].DefaultValue = Server.HtmlEncode(txtSix.Text);

sqlLotto.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
sqlLotto.SelectCommand = sproc;

try
{
LottoList.DataBind();
}
catch(Exception ex)
{
ex.ToString();
}

}
protected void btnSearch_Click(object sender, EventArgs e)
{
if (Session["numberOne"] == null)
{
Session["numberOne"] = txtOne.Text;

}
if (Session["numberTwo"] == null)
{
Session["numberTwo"] = txtTwo.Text;
}
if (Session["numberThree"] == null)
{
Session["numberThree"] = txtThree.Text;
}
if (Session["numberFour"] == null)
{
Session["numberFour"] = txtFour.Text;
}
if (Session["numberFive"] == null)
{
Session["numberFive"] = txtFive.Text;
}
if (Session["numberSix"] == null)
{
Session["numberSix"] = txtSix.Text;
}

LottoList.DataBind();

populateListView(lblpageNumber.Text, numberOfRecords, sproc);

}
protected void btnClear_Click(object sender, EventArgs e)
{


foreach (ListViewDataItem item in LottoList.Items)
{
Label lblNumberOne = (Label)item.FindControl("numberOne");
Label lblNumberTwo = (Label)item.FindControl("numberTwo");
Label lblNumberThree = (Label)item.FindControl("numberThree");
Label lblNumberFour = (Label)item.FindControl("numberFour");
Label lblNumberFive = (Label)item.FindControl("numberFive");
Label lblNumberSix = (Label)item.FindControl("numberSix");

lblNumberOne.ForeColor = Color.Black;
lblNumberTwo.ForeColor = Color.Black;
lblNumberThree.ForeColor = Color.Black;
lblNumberFour.ForeColor = Color.Black;
lblNumberFive.ForeColor = Color.Black;
lblNumberSix.ForeColor = Color.Black;

lblNumberOne.Font.ClearDefaults();
lblNumberTwo.Font.ClearDefaults();
lblNumberThree.Font.ClearDefaults();
lblNumberFour.Font.ClearDefaults();
lblNumberFive.Font.ClearDefaults();
lblNumberSix.Font.ClearDefaults();





}
}

protected void populateCustomPager(string currentPage)
{
//a counter to loop through while loops
int counter = 1;

//max number of links (1,2,3,4,5...) per pager control
int maxLinksPerPage = 9;

//convert currentPage to an int used in the while loops
int pageLink = Convert.ToInt32(currentPage);


//always have the 'first' button link going to page one. This is static.
//linkFirst.NavigateUrl = "~/Search.aspx?categoryID=" + categoryID + "&search=" + userSearch + "&criteria=" + criteria + "&sort=" + sortID + "&page=1";
linkFirst.NavigateUrl = FormatURL.FormatAboutPage("1");
linkFirst.Visible = true;

//find max page count of not null data
//int maxToDisplay = findMaxPagesToDisplay(categoryID, displayPerPage);
int maxToDisplay = findMaxPagesToDisplay();

int maxToDisplayOnPage = Convert.ToInt32(numberOfRecords);
//if there are no records to display, do not show any link buttons

//find remainder, if not 0, add one to the max displayed per page
if ((maxToDisplay % maxToDisplayOnPage) == 0)
{
maxToDisplay = maxToDisplay / maxToDisplayOnPage;
customPager.Visible = true;
}
else
{
maxToDisplay = (maxToDisplay / maxToDisplayOnPage) + 1;
customPager.Visible = true;
}

if (maxToDisplay == 0)
{
/*
if (link1.Text == "")
{
link1.NavigateUrl = "~/Search.aspx?categoryID=" + categoryID + "&search=" + userSearch + "&criteria=" + criteria + "&sort=" + sortID + "&page=" + pageLink;
link1.Text = pageLink.ToString();
link1.Visible = true;
link1.BackColor = System.Drawing.Color.Red;
link1.BorderColor = System.Drawing.Color.Red;
}
*/
linkFirst.Visible = false;
customPager.Visible = true;
//TODO: Javascript to make div with id = "customPager" invisible
return;
}

//customPager.Visible = true;

//add the link info for the 'last' button. Also static.
//linkLast.NavigateUrl = "~/Search.aspx?categoryID=" + categoryID + "&search=" + userSearch + "&criteria=" + criteria + "&sort=" + sortID + "&page=" + maxToDisplay;
linkLast.NavigateUrl = FormatURL.FormatAboutPage(maxToDisplay.ToString());
linkLast.Visible = true;

//create a custom pager control with links having SEO friendly querystrings
if ((pageLink - 4) <= 0)
{
if (pageLink == 1)
{
int orginalPageLink = pageLink;
while (counter < (maxLinksPerPage + 1))
{
if (link1.Text == "")
{
link1.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link1.Text = pageLink.ToString();
link1.Visible = true;
link1.ForeColor = System.Drawing.Color.Black;
link1.BackColor = System.Drawing.Color.White;
//link1.BorderColor = System.Drawing.Color.Red;
}
else if (link2.Text == "")
{
link2.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link2.Text = pageLink.ToString();
link2.Visible = true;
}
else if (link3.Text == "")
{
link3.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link3.Text = pageLink.ToString();
link3.Visible = true;
}
else if (link4.Text == "")
{
link4.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link4.Text = pageLink.ToString();
link4.Visible = true;
}
else if (link5.Text == "")
{
link5.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link5.Text = pageLink.ToString();
link5.Visible = true;
}
else if (link6.Text == "")
{
link6.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link6.Text = pageLink.ToString();
link6.Visible = true;
}
else if (link7.Text == "")
{
link7.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link7.Text = pageLink.ToString();
link7.Visible = true;
}
else if (link8.Text == "")
{
link8.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link8.Text = pageLink.ToString();
link8.Visible = true;
}
else if (link9.Text == "")
{
link9.NavigateUrl = FormatURL.FormatAboutPage(pageLink.ToString());
link9.Text = pageLink.ToString();
link9.Visible = true;
}
pageLink++;
counter++;
}
if (orginalPageLink == maxToDisplay)
{
linkLast.Visible = false;
link2.Visible = false;
link3.Visible = false;
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;

}
else if (maxToDisplay == 2)
{
link3.Visible = false;
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 3)
{
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 4)
{
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 5)
{
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 6)
{
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 7)
{
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 8)
{
link9.Visible = false;
}
}
else if (pageLink == 2)
{
int orginalPageLink = pageLink;
while (counter < (maxLinksPerPage + 1))
{
if (link1.Text == "")
{
int value = (pageLink - 1);
link1.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link1.Text = value.ToString();
link1.Visible = true;
}
else if (link2.Text == "")
{
int value = (pageLink - 1);
link2.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link2.Text = value.ToString();
link2.Visible = true;
link2.ForeColor = System.Drawing.Color.Black;
link2.BackColor = System.Drawing.Color.White;
}
else if (link3.Text == "")
{
int value = (pageLink - 1);
link3.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link3.Text = value.ToString();
link3.Visible = true;
}
else if (link4.Text == "")
{
int value = (pageLink - 1);
link4.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link4.Text = value.ToString();
link4.Visible = true;
}
else if (link5.Text == "")
{
int value = (pageLink - 1);
link5.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link5.Text = value.ToString();
link5.Visible = true;
}
else if (link6.Text == "")
{
int value = (pageLink - 1);
link6.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link6.Text = value.ToString();
link6.Visible = true;
}
else if (link7.Text == "")
{
int value = (pageLink - 1);
link7.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link7.Text = value.ToString();
link7.Visible = true;
}
else if (link8.Text == "")
{
int value = (pageLink - 1);
link8.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link8.Text = value.ToString();
link8.Visible = true;
}
else if (link9.Text == "")
{
int value = (pageLink - 1);
link9.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link9.Text = value.ToString();
link9.Visible = true;
}
pageLink++;
counter++;
}
if (orginalPageLink == maxToDisplay)
{
linkLast.Visible = false;
link3.Visible = false;
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 3)
{
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 4)
{
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 5)
{
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 6)
{
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 7)
{
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 8)
{
link9.Visible = false;
}
}
else if (pageLink == 3)
{
int orginalPageLink = pageLink;
while (counter < (maxLinksPerPage + 1))
{
if (link1.Text == "")
{
int value = (pageLink - 2);
link1.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link1.Text = value.ToString();
link1.Visible = true;
}
else if (link2.Text == "")
{
int value = (pageLink - 2);
link2.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link2.Text = value.ToString();
link2.Visible = true;
}
else if (link3.Text == "")
{
int value = (pageLink - 2);
link3.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link3.Text = value.ToString();
link3.Visible = true;
link3.ForeColor = System.Drawing.Color.Black;
link3.BackColor = System.Drawing.Color.White;
}
else if (link4.Text == "")
{
int value = (pageLink - 2);
link4.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link4.Text = value.ToString();
link4.Visible = true;
}
else if (link5.Text == "")
{
int value = (pageLink - 2);
link5.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link5.Text = value.ToString();
link5.Visible = true;
}
else if (link6.Text == "")
{
int value = (pageLink - 2);
link6.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link6.Text = value.ToString();
link6.Visible = true;
}
else if (link7.Text == "")
{
int value = (pageLink - 2);
link7.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link7.Text = value.ToString();
link7.Visible = true;
}
else if (link8.Text == "")
{
int value = (pageLink - 2);
link8.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link8.Text = value.ToString();
link8.Visible = true;
}
else if (link9.Text == "")
{
int value = (pageLink - 2);
link9.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link9.Text = value.ToString();
link9.Visible = true;
}
pageLink++;
counter++;
}
if (orginalPageLink == maxToDisplay)
{
linkLast.Visible = false;
link4.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 4)
{
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 5)
{
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 6)
{
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 7)
{
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 8)
{
link9.Visible = false;
}
}
else if (pageLink == 4)
{
int orginalPageLink = pageLink;
while (counter < (maxLinksPerPage + 1))
{
if (link1.Text == "")
{
int value = (pageLink - 3);
link1.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link1.Text = value.ToString();
link1.Visible = true;
}
else if (link2.Text == "")
{
int value = (pageLink - 3);
link2.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link2.Text = value.ToString();
link2.Visible = true;
}
else if (link3.Text == "")
{
int value = (pageLink - 3);
link3.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link3.Text = value.ToString();
link3.Visible = true;
}
else if (link4.Text == "")
{
int value = (pageLink - 3);
link4.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link4.Text = value.ToString();
link4.Visible = true;
link4.ForeColor = System.Drawing.Color.Black;
link4.BackColor = System.Drawing.Color.White;
}
else if (link5.Text == "")
{
int value = (pageLink - 3);
link5.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link5.Text = value.ToString();
link5.Visible = true;
}
else if (link6.Text == "")
{
int value = (pageLink - 3);
link6.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link6.Text = value.ToString();
link6.Visible = true;
}
else if (link7.Text == "")
{
int value = (pageLink - 3);
link7.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link7.Text = value.ToString();
link7.Visible = true;
}
else if (link8.Text == "")
{
int value = (pageLink - 3);
link8.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link8.Text = value.ToString();
link8.Visible = true;
}
else if (link9.Text == "")
{
int value = (pageLink - 3);
link9.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link9.Text = value.ToString();
link9.Visible = true;
}
pageLink++;
counter++;
}
if (orginalPageLink == maxToDisplay)
{
linkLast.Visible = false;
link5.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 5)
{
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 6)
{
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 7)
{
link8.Visible = false;
link9.Visible = false;
}
else if (maxToDisplay == 8)
{
link9.Visible = false;
}
}
}
else
{
int isLast = pageLink;
while (counter < (maxLinksPerPage + 1))
{
if (link1.Text == "")
{
int value = (pageLink - 4);
link1.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link1.Text = value.ToString();
link1.Visible = true;
}
else if (link2.Text == "")
{
int value = (pageLink - 4);
link2.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link2.Text = value.ToString();
link2.Visible = true;
}
else if (link3.Text == "")
{
int value = (pageLink - 4);
link3.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link3.Text = value.ToString();
link3.Visible = true;
}
else if (link4.Text == "")
{
int value = (pageLink - 4);
link4.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link4.Text = value.ToString();
link4.Visible = true;
}
else if (link5.Text == "")
{
int value = (pageLink - 4);
link5.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link5.Text = value.ToString();
link5.Visible = true;
link5.ForeColor = System.Drawing.Color.Black;
link5.BackColor = System.Drawing.Color.White;
}
else if (link6.Text == "")
{
int value = (pageLink - 4);
link6.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link6.Text = value.ToString();
link6.Visible = true;
}
else if (link7.Text == "")
{
int value = (pageLink - 4);
link7.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link7.Text = value.ToString();
link7.Visible = true;
}
else if (link8.Text == "")
{
int value = (pageLink - 4);
link8.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link8.Text = value.ToString();
link8.Visible = true;
}
else if (link9.Text == "")
{
int value = (pageLink - 4);
link9.NavigateUrl = FormatURL.FormatAboutPage(value.ToString());
link9.Text = value.ToString();
link9.Visible = true;
}
pageLink++;
counter++;
}
if (isLast == maxToDisplay)
{
linkLast.Visible = false;
link6.Visible = false;
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (((Convert.ToInt32(link9.Text)) - maxToDisplay) == 3)
{
link7.Visible = false;
link8.Visible = false;
link9.Visible = false;
}
else if (((Convert.ToInt32(link9.Text)) - maxToDisplay) == 2)
{
link8.Visible = false;
link9.Visible = false;
}
else if (((Convert.ToInt32(link9.Text)) - maxToDisplay) == 1)
{
link9.Visible = false;
}

}

}

protected int findMaxPagesToDisplay()
{
//set a default value for the return variable
int maxPagesAllowed = 0;

//set connection variables and sqlcommand parameters
SqlConnection conn = new SqlConnection(connString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;



//set output parameter for maxPagesToDisplay
SqlParameter maxPages = new SqlParameter("@maxpages", SqlDbType.Int);
maxPages.Direction = ParameterDirection.Output;
cmd.Parameters.Add(maxPages);

//set properties for sqlcommand object
cmd.CommandText = "[pages]";
cmd.CommandType = CommandType.StoredProcedure;
try
{
conn.Open();
cmd.ExecuteNonQuery();

//caputure output variable into an int
maxPagesAllowed = Int32.Parse(cmd.Parameters["@maxpages"].Value.ToString());
}
catch (Exception ex)
{
}
finally
{
conn.Close();
}

return maxPagesAllowed;
}
}
Back-end Code

Mark-Up
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="About.aspx.cs" Inherits="About" %>





 



















































































No Results






















First



















Last
























Overview :  My code highlights numbers based on a search button and i have a pager so i can acces all the pages in my list view.


Problem : I need the highlighted number to be saved and run the code over top of the saved highlted numbers and im not sure how to go about it. Any feedback would be great 


Thanks, 


Joseph





Hi,


Just save your states into an Array or a List, and each data-binding, plz find them out and assign to ListView.


See this similar sample:


http://www.ezineasp.net/post/Maintain-Checkbox-state-while-GridView-Paging-in-ASP-Net.aspx