Gridview - Accessing Textbox in outside gridview event when text change event of same gridview textbox in ASP.NET
1. Trigger textbox change Event in inside gridview and make auto post back = true
Setting Current Date
Protected Sub txtDeliveryDateF_TextChanged(sender As Object, e As System.EventArgs)
Dim txtDeliveryDateF As TextBox = grdProducts.FooterRow.FindControl("txtDeliveryDateF")
' Dim txtDeliveryDateF As TextBox = e.Row.FindControl("txtDeliveryDateF")
If Len(Trim(txtDeliveryDateF.Text & "")) = 0 Then
txtDeliveryDateF.Text = Now.Date
End If
If Len(Trim(txtDeliveryDateF.Text & "")) <> 0 Then
Dim dateDeliveryDate As DateTime = Convert.ToDateTime(txtDeliveryDateF.Text)
Dim txtWeekF As TextBox = grdProducts.FooterRow.FindControl("txtWeekF")
txtWeekF.Text = GetWeekNumber(dateDeliveryDate)
End If
End Sub
Setting Current Date
Protected Sub txtDeliveryDateF_TextChanged(sender As Object, e As System.EventArgs)
Dim txtDeliveryDateF As TextBox = grdProducts.FooterRow.FindControl("txtDeliveryDateF")
' Dim txtDeliveryDateF As TextBox = e.Row.FindControl("txtDeliveryDateF")
If Len(Trim(txtDeliveryDateF.Text & "")) = 0 Then
txtDeliveryDateF.Text = Now.Date
End If
If Len(Trim(txtDeliveryDateF.Text & "")) <> 0 Then
Dim dateDeliveryDate As DateTime = Convert.ToDateTime(txtDeliveryDateF.Text)
Dim txtWeekF As TextBox = grdProducts.FooterRow.FindControl("txtWeekF")
txtWeekF.Text = GetWeekNumber(dateDeliveryDate)
End If
End Sub
Comments
Post a Comment