Sajid Hussain

Sajid Hussain

  • 1.2k
  • 514
  • 100.2k

Textchange event in gridview does not work

Sep 28 2015 5:09 AM
i have a gridview in which i have two text boxes and one button ,when user click on
button a new row with two textboxes is added, i want to use text change event in 1st
textbox, and at the end pass a value to 2nd text box,problem is that ,value does not show up in the textbox
Hide Copy Code
protected void txtCode_TextChanged(object sender, EventArgs e)     
   {           GridViewRow currentRow =(GridViewRow)((TextBox)sender).Parent.Parent;      
     TextBox txt = (TextBox)currentRow.FindControl("txtCode");      
     TextBox txtfine = (TextBox)currentRow.FindControl("txtFine");     
         Int32 count =Convert.ToInt32( txt.Text);           
     var chkradio = rblQualification.SelectedValue;         
       byte chkRadio = SafeConvert.ToByte(chkradio);           
     var vehiclecategory = _service.GetAllVehicleCategory().Where(x => x.ID == chkRadio).FirstOrDefault();    
            var vehicletype = vehiclecategory.VehicleType_Id;  
              var pntytype = _service.GetAllVehiclePenaltyType().Where(x => x.ID == SafeConvert.ToByte(count)).Count();    
            var plntyfee = _service.GetAllVehiclePenaltiesFee().Where(x => x.VehicleTypeID == vehicletype && x.VehiclePenaltyTypeID == vehicletype).FirstOrDefault();             txtfine.Text = plntyfee.Fee.ToString();          }

Answers (7)