Tuesday, August 05, 2008

select checkboxlist based on to database data

foreach(datarow in the query result)
{

ListItem currentCheckBox = CheckBoxListABC.Items.FindByValue(datarow ["TheFieldName"].ToString());
if (currentCheckBox != null)
{
currentCheckBox.Selected = true;
}
}

Monday, August 04, 2008

ASP.NET C# capitalize the first letter of a string

using System.Globalization;
..
..
..
..
..
string ManipulatedString= CultureInfo.CurrentCulture.TextInfo.ToTitleCase("OriginalString");

Saturday, August 02, 2008

"postback" event not related to REVIOUS and NEXT button on Internet Explorer?

in my case PageA has a buttonA that opens PageB. The code is "response.redirect("PageB.aspx");"

on PageB I have some methodM to call under condition "if (!IsPostBack)"

After I clicked on ButtoA to open PageB, methodM is trigerred.

but when I use the PREVIOUS button on Internet Explore to go back to PageA and click on NEXT button to go back to PageB the methodM didn't fire.

How can I catch the Previous and Next button click event?

the answer is adding the code below into Page_Load in the target page, this line of code will force the target page to load from server instead of cache

Response.Cache.SetCacheability(HttpCacheability.NoCache);