コード例 #1
0
		protected void dlstCountry_ItemCommand(object source, DataListCommandEventArgs e)
		{
			LinkButton lbtnCountry = (LinkButton)e.Item.FindControl("lbtnCountry");
			lbtnCountry1.Text = lbtnCountry.Text;
			mvMain.SetActiveView(viewTours);
			WebDataAccess webDataAccess = new WebDataAccess();

			DataTable dt = webDataAccess.GetTour("I", tourSubType, Convert.ToInt32(lbtnCountry.CommandArgument));
			dlstTour.DataSource = dt;
			dlstTour.DataBind();
			int tourId = 0;
			foreach (DataListItem item in dlstTour.Items)
			{
				DataRow row = dt.Rows[item.ItemIndex];
				if (!string.IsNullOrEmpty(Convert.ToString(row["WEB_PHOTO_CONTENT"])))
				{
					ImageButton imgPhoto = (ImageButton)item.FindControl("imgPhoto");
					if (imgPhoto != null)
					{
						Int32.TryParse(imgPhoto.CommandArgument, out tourId);
						//HttpContext.Current.Session["DataRow"] = row;
						imgPhoto.ImageUrl = "~/Shared/ImageHandler.ashx?id=" + tourId + "&phototype=tour";
					}
				}
				if (!string.IsNullOrEmpty(Convert.ToString(row["NO_OF_NIGHTS"])) && !string.IsNullOrEmpty(Convert.ToString(row["NO_OF_DAYS"])))
				{
					Label Label1 = (Label)item.FindControl("Label1");
					if (Label1 != null)
					{
						Label1.Text = row["NO_OF_NIGHTS"].ToString() + " Nights/" + row["NO_OF_DAYS"].ToString() + " Days";
					}
				}


			}
		}