When the user sets the textbox property as readonly. It does not have the viewstate. So Value wont display or comes to the server. In order to achieve the output make the textbox readonly after getting the value like this
string s=textbox1.text;
textbo1.readonly=true;
Friday, July 22, 2011
Sunday, July 17, 2011
Enabling and Disabling of buttons of prev, next, first and last
private void EnableOrDisableButtons()
{
//=== check the condition total no of pages is greater than zero ==============
if(TotalNumberOfPages >0){
//===== Initial setup =============
if(CurentPageNumber == 0)
{
CurentPageNumber = 1;
}
//===== Now the User is in First Page [Total page is 1] =============
if ((CurentPageNumber == 1) && ( CurentPageNumber == TotalNumberOfPages))
{
lnkFirst.Enabled = lnkPrev.Enabled = false;
}
//===== Now the User is in middle Page =============
else if (CurentPageNumber == 1 && CurentPageNumber < TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = false;
lnkNextButton.Enabled = lnkLastButton.Enabled = true;
}
//===== here also Now the User is in middle Page =============
else if (CurentPageNumber > 1 && CurentPageNumber < TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = lnkNextButton.Enabled = lnkLastButton.Enabled = true;
}
//===== Now the User is in last Page =============
else if (CurentPageNumber == TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = true;
lnkNextButton.Enabled = lnkLastButton.Enabled = false;
}
//======= Setting the page Numbers=======
this.lblPage.Text = CurentPageNumber.ToString() + " of " + TotalNumberOfPages.ToString();
}
{
//=== check the condition total no of pages is greater than zero ==============
if(TotalNumberOfPages >0){
//===== Initial setup =============
if(CurentPageNumber == 0)
{
CurentPageNumber = 1;
}
//===== Now the User is in First Page [Total page is 1] =============
if ((CurentPageNumber == 1) && ( CurentPageNumber == TotalNumberOfPages))
{
lnkFirst.Enabled = lnkPrev.Enabled = false;
}
//===== Now the User is in middle Page =============
else if (CurentPageNumber == 1 && CurentPageNumber < TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = false;
lnkNextButton.Enabled = lnkLastButton.Enabled = true;
}
//===== here also Now the User is in middle Page =============
else if (CurentPageNumber > 1 && CurentPageNumber < TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = lnkNextButton.Enabled = lnkLastButton.Enabled = true;
}
//===== Now the User is in last Page =============
else if (CurentPageNumber == TotalNumberOfPages)
{
lnkFirst.Enabled = lnkPrev.Enabled = true;
lnkNextButton.Enabled = lnkLastButton.Enabled = false;
}
//======= Setting the page Numbers=======
this.lblPage.Text = CurentPageNumber.ToString() + " of " + TotalNumberOfPages.ToString();
}
Subscribe to:
Posts (Atom)