Aktham Mahmoud

Aktham Mahmoud

  • NA
  • 720
  • 35k

pass Details View label value to Form View

Feb 9 2020 10:19 AM
I'm trying to pass Delatils View Label value to to Details view.
you can see code below
  1. protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)  
  2. {  
  3.     if (e.CommandName.Equals("apply"))  
  4.     {  
  5.         Frm_User.Visible = true;  
  6.   
  7.         Label LbdvCode1 = (Label)DetailsView1.Rows[0].FindControl("lb_Jcode");  
  8.                
  9.         Label LbfrmCode1 = (Label)Frm_User.FindControl("LB_VacancyCode");  
  10.         LbfrmCode1.Text = LbdvCode1.ToString();  
  11.     }  
  12.     if (e.CommandName.Equals("Cancel"))  
  13.     {  
  14.         Response.Redirect("~/jobs.aspx");  
  15.     }  
  16.           
  17. }  
Code Below Form View ItemCommand Event:
  1. protected void Frm_User_ItemCommand(object sender, FormViewCommandEventArgs e)  
  2. {  
  3.   
  4.     try  
  5.     {  
  6.         if (e.CommandName.Equals("Insert"))  
  7.         {  
  8.                                      
  9.             Frm_User.DataBind();  
  10.             LBFRm_Suc.Text = "Your Vacancy Order has been submitted.";  
  11.         }  
  12.     }  
  13.     catch (Exception ex)  
  14.     {  
  15.   
  16.         LBFRm_Fail.Text = ex.Message;  
  17.     }  
  18.     if (e.CommandName.Equals("Cancel"))  
  19.     {  
  20.         Frm_User.Controls.Clear();  
  21.         Frm_User.Visible = false; }  
  22. }  
 In Form View Event (LOad) am trying to catch label vlaue in Details View but no way, see code below:
 
  1. protected void Frm_User_Load(object sender, EventArgs e)  
  2. {  
  3.     Label Lbfrmdate = (Label)Frm_User.Row.FindControl("LB_FRMDate");  
  4.     Lbfrmdate.Text = DateTime.Now.ToShortDateString();  
  5.     //==========  
  6.     //Label LbdvCode1 = (Label)DetailsView1.Rows[0].FindControl("lb_Jcode");  
  7.     //Label LbfrmCode1 = (Label)Frm_User.FindControl("LB_VacancyCode");  
  8.     //LbfrmCode1.Text = LbdvCode1.ToString();      
  9. }  
See a photo to know what I mean:

Answers (1)