Private Sub grdUsers_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles grdUsers.RowEditing
ViewState("Pflag") = True
count = count + 1
MakeTrue(Pflag)
Dim Tehsilid As String = Nothing
Dim DistrictId As String = Nothing
Dim UCId As String = Nothing
Dim villageID As String = Nothing
Dim cnnUser As New SqlConnection(AppSettings("DbSqlPortal"))
Dim cmdUser As New SqlCommand("FirstCREATE", cnnUser)
Dim drUser As SqlDataReader = Nothing
cmdUser.CommandType = CommandType.StoredProcedure
cmdUser.Parameters.Add("@UserId", SqlDbType.BigInt).Value = CInt(grdUsers.DataKeys(e.NewEditIndex).Value)
Dim litUserIds As Integer = CInt(grdUsers.DataKeys(e.NewEditIndex).Value).ToString()
cnnUser.Open()
drUser = cmdUser.ExecuteReader()
If drUser.HasRows Then
While (drUser.Read())
DisplayInitialForm()
litUserId.Text = CInt(drUser("UserId"))
txtFullName.Text = drUser("FullName")
txtEmail.Text = drUser("Email")
txtPassword.Text = drUser("Password")
txtAnswer.Text = drUser("SecurityAnswer")
ddlSecurityQuestions.SelectedValue = drUser("SecurityQuestion")
chkAdmin.Checked = drUser("IsAdmin")
ddlOrganization.SelectedValue = drUser("OrganizationId")
chkActive.Checked = drUser("IsActive")
If drUser("Gender") = "M" Then
rbMale.Checked = True
ElseIf drUser("Gender") = "W" Then
rbFemale.Checked = True
End If
ChkIsReportAble.Checked = CBool(drUser("IsReportable"))
ddlUserTypes.SelectedValue = drUser("UserTypes")
ddlOrganization.SelectedValue = drUser("OrganizationID")
If drUser("UserTypes") = "4" Then
fillReportablePeopleListForPartner()
Else
fillReportablePeopleList()
If ChkIsReportAble.Checked Then
ddlReporintUser.SelectedValue = Convert.ToString(drUser("ReporintPerson"))
Dim i As Int32
Dim j As Int32
For i = 0 To CheckBoxList1.Items.Count - 1
Dim strChkID As String = drUser("DistrictID")
If CheckBoxList1.Items(i).Value = strChkID Then
CheckBoxList1.Items.Item(i).Selected = True
Next
PopulateTehsil()
If (drUser.NextResult()) Then
While drUser.Read()
For j = 0 To CheckBoxList2.Items.Count - 1
Dim strChkIDs As String = drUser("TehsilId").ToString()
If CheckBoxList2.Items(j).Value = strChkIDs Then
CheckBoxList2.Items.Item(j).Selected = True
Tehsilid &= drUser("TehsilId").ToString() & ","
Session("savedTehsil") = Tehsilid
End While
If Tehsilid IsNot Nothing Then
Dim word As String() = Tehsilid.Split(",")
For Each li In word
If li = CheckBoxList2.Items.Item(j).Value Then
PopulateUcs()
If drUser.NextResult() Then
For j = 0 To CheckBoxList3.Items.Count - 1
Dim strChkIDss As String = drUser("UCID").ToString()
If CheckBoxList3.Items(j).Value = strChkIDss Then
CheckBoxList3.Items.Item(j).Selected = True
UCId &= drUser("UCID").ToString() & ","
Session("seceltedUcs") = UCId
If UCId IsNot Nothing Then
Dim wordss As String() = UCId.Split(",")
For Each li In wordss
If li = CheckBoxList3.Items.Item(j).Value Then
PopulateVillages()
If drUser.NextResult Then
For j = 0 To CheckBoxList4.Items.Count - 1
Dim strChkIDsss As String = drUser("VillageId").ToString()
If CheckBoxList4.Items(j).Value = strChkIDsss Then
CheckBoxList4.Items.Item(j).Selected = True
villageID &= drUser("VillageId").ToString() & ","
Session("VillagesID") = villageID
If villageID IsNot Nothing Then
Dim wordsss As String() = villageID.Split(",")
For Each li In wordsss
If li = CheckBoxList4.Items.Item(j).Value Then
End Sub