I have a grid view on other page but i want to get text box value from prevoius page in the grid view selection change index event.
i mean entering start date and end date from previus page i get it in the grid view selectd chang index event how is possible?
protected
void GridView1_SelectedIndexChanged(object sender, EventArgs e){
// int index = GridView1.SelectedIndex; int id = (int)GridView1.SelectedDataKey.Values["Car_id"]; // Label1.Text=id.ToString();DetailsView1.PageIndex = GridView1.SelectedIndex;
string connectionString = (string)ConfigurationSettings.AppSettings["dbconnectionstr"];
OleDbConnection conn = new OleDbConnection(connectionString);
conn.Open();
string commandstring = "Select * from Rates where Car_id=" + id; OleDbCommand cmnon = new OleDbCommand(commandstring, conn); OleDbDataReader rd = cmnon.ExecuteReader(); while (rd.Read()){
Label2.Text = rd[
"Car_Name"].ToString();}
/////////////////////////////////////////////////////////////from here i am getting problem it does not get previus page properties which are Datestart and Datend....................................................................................
int rent, tot = 0; DateTime start = DateTime.Parse(PreviousPage.Datestart); DateTime end = DateTime.Parse(PreviousPage.Dateend); int totdays = (end - start).Days + 1; if (totdays <= 1)
{
lbhire.Text =
"Sorry start date can't be greater then end date for same month";}
else{
lbhire.Text =
Convert.ToString(totdays);
if (totdays >= 2 && totdays <= 6)
{
rent =
Convert.ToInt32(rd["2_6DaysLowSeason"].ToString());
}
else if (totdays >= 7 && totdays <= 13){
rent =
Convert.ToInt32(rd["7_13DaysLowSeason"].ToString());
}
else{
rent =
Convert.ToInt32(rd["14+DaysLowSeason"].ToString());
}
tot = rent * totdays;
lbtot.Text = tot.ToString();
// Label8.Text=rd["VAT%"].ToString();}
Tabish SarwarPosted Nov 3, 2008, 7:56 AM
After then you will be able to get it in where ever you required be it a selection changed event.
First you have to get that particular value to page you are working.
Regards,
Tabish