please help my footer textbox are getting this , comma sign
yet they are supposed to remain empty when no value has been inserted in them
Dim fName As String = DirectCast(StudentGrid.FooterRow.FindControl("Namesf"), TextBox).Text
Dim valueSEX As String = TryCast(StudentGrid.FooterRow.FindControl("ddlSexF"), DropDownList).SelectedItem.Value
Dim faddress As String = DirectCast(StudentGrid.FooterRow.FindControl("faddress"), TextBox).Text
Dim fphone As String = DirectCast(StudentGrid.FooterRow.FindControl("Fphone"), TextBox).Text
Dim fage As String = DirectCast(StudentGrid.FooterRow.FindControl("Fage"), TextBox).Text
Dim fdate As String = DirectCast(StudentGrid.FooterRow.FindControl("Fdates"), TextBox).Text
when i click
Protected Sub Button2_Click1(sender As Object, e As EventArgs)
Dim fName As String = DirectCast(StudentGrid.FooterRow.FindControl("Namesf"), TextBox).Text
Dim valueSEX As String = TryCast(StudentGrid.FooterRow.FindControl("ddlSexF"), DropDownList).SelectedItem.Value
Dim faddress As String = DirectCast(StudentGrid.FooterRow.FindControl("faddress"), TextBox).Text
Dim fphone As String = DirectCast(StudentGrid.FooterRow.FindControl("Fphone"), TextBox).Text
Dim fage As String = DirectCast(StudentGrid.FooterRow.FindControl("Fage"), TextBox).Text
Dim fdate As String = DirectCast(StudentGrid.FooterRow.FindControl("Fdates"), TextBox).Text
If String.IsNullOrEmpty(fdate) Then
fdate = Now
End If
If String.IsNullOrEmpty(valueSEX) Then
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('You Must Indicate whether Male Or Female');", True)
TryCast(StudentGrid.FooterRow.FindControl("ddlSexF"), DropDownList).Focus()
Exit Sub
Else
If String.IsNullOrEmpty(fName) Then
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('You Must Indicate Student Name');", True)
TryCast(StudentGrid.FooterRow.FindControl("Namesf"), TextBox).Focus()
Exit Sub
Else
Dim sqlConnection12 As New SqlConnection(conString)
Dim objCommand22 As SqlCommand = New SqlCommand()
Dim cmd2 As New SqlCommand
cmd2.CommandText = "createaccounts"
cmd2.CommandType = CommandType.StoredProcedure
cmd2.Connection = sqlConnection12
cmd2.Parameters.Add("@n", SqlDbType.NVarChar, 150).Value = fName
cmd2.Parameters.Add("@s", SqlDbType.NVarChar, 12).Value = valueSEX
cmd2.Parameters.Add("@d", SqlDbType.NVarChar, 12).Value = faddress
cmd2.Parameters.Add("@P", SqlDbType.NVarChar, 12).Value = fphone
cmd2.Parameters.Add("@g", SqlDbType.NVarChar, 12).Value = fage
cmd2.Parameters.Add("@dd", SqlDbType.NVarChar, 12).Value = fdate
sqlConnection12.Open()
cmd2.ExecuteReader()
sqlConnection12.Close()
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('Record Inserted Successfully');", True)
BindGrid()
End If
End If