Click here to Skip to main content
15,867,568 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Search Pin
Deepak the Cool22-Nov-07 18:17
Deepak the Cool22-Nov-07 18:17 
QuestionLast 10 disit number or 10 character from from 13 disit nuber or 13 character Pin
Sarfaraj Ahmed22-Nov-07 12:27
Sarfaraj Ahmed22-Nov-07 12:27 
AnswerRe: Last 10 disit number or 10 character from from 13 disit nuber or 13 character Pin
Mustafa Ismail Mustafa22-Nov-07 12:41
Mustafa Ismail Mustafa22-Nov-07 12:41 
QuestionError Message - Try-Catch Block Pin
dataminers22-Nov-07 9:26
dataminers22-Nov-07 9:26 
AnswerRe: Error Message - Try-Catch Block Pin
dataminers22-Nov-07 9:57
dataminers22-Nov-07 9:57 
GeneralRe: Error Message - Try-Catch Block Pin
pmarfleet22-Nov-07 11:23
pmarfleet22-Nov-07 11:23 
AnswerRe: Error Message - Try-Catch Block Pin
Sherin Iranimose22-Nov-07 18:12
Sherin Iranimose22-Nov-07 18:12 
QuestionDropdown inside a repeator control using vb Pin
Oga M22-Nov-07 5:53
Oga M22-Nov-07 5:53 
Please Guys look at my Code,it is working when I click Button1 it lots all the controls that I want inside a repeator,But My problem is that I want the second dropdown inside a repeator to display the value depending/according on the first dropdown selection.How do I go about?
Eg DropDown1 loads all the car name(toyota,audi,bmw)
after selection,maybe (Audi)Dropdown2 load(A3,A4) Who do I go about inside the repeator


Code


Imports System.Net.Mail

Partial Class cap
Inherits System.Web.UI.Page
Dim OSource As Businesslayer.Users = New Businesslayer.Users
Dim rs As Data.DataSet
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As New Data.DataSet
Dim obj As Businesslayer.ClientSite = New Businesslayer.ClientSite
Dim NumberOfBoxes As Integer
Dim WhichBox As Integer
Dim rows() As Integer

NumberOfBoxes = Integer.Parse(txtDay.Text) - 1

ReDim rows(NumberOfBoxes)

For WhichBox = 0 To NumberOfBoxes
rows(WhichBox) = WhichBox
Next

Repeater1.DataSource = rows
Repeater1.DataBind()

For WhichBox = 0 To NumberOfBoxes


Dim cmbProjectName As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbProjectName"), DropDownList)
ds = obj.GetProjectNameFromProjAdmin
cmbProjectName.DataSource = ds
cmbProjectName.DataBind()
cmbProjectName.Items.Add(New ListItem("", ""))
cmbProjectName.Items.Item(cmbProjectName.Items.Count - 1).Selected = True

Dim cmbClientSite As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbClientSite"), DropDownList)
ds = obj.GetClientIDFromProjAdmin
cmbClientSite.DataSource = ds
cmbClientSite.DataBind()
cmbClientSite.Items.Add(New ListItem("", ""))
cmbClientSite.Items.Item(cmbClientSite.Items.Count - 1).Selected = True

Dim cmbProjectManager As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbProjectManager"), DropDownList)
ds = obj.GetProjectManagers
cmbProjectManager.DataSource = ds
cmbProjectManager.DataBind()
cmbProjectManager.Items.Add(New ListItem("", ""))
cmbProjectManager.Items.Item(cmbProjectManager.Items.Count - 1).Selected = True

Dim cmbCategory As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbCategory"), DropDownList)
ds = obj.GetCategory
cmbCategory.DataSource = ds
cmbCategory.DataBind()
cmbCategory.Items.Add(New ListItem("", ""))
cmbCategory.Items.Item(cmbCategory.Items.Count - 1).Selected = True

Next
End Sub

Protected Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles Repeater1.ItemCommand
Repeater1.FindControl("DropDownList1")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rptErrors As New ValidationSummary
If Page.IsPostBack = False Then
txtProjectMember.Text = Session("Name") & " " & Session("Surname")
txtIDNumber.Text = Session("IdNumber")
txtEmail.Text = Session("Email")
bntSubMana.Visible = "False"
rptErrors.Visible = False
End If
'If Not Page.IsPostBack Then
' rptErrors.Visible = False
'End If
End Sub


Public Sub UserMsgBox(ByVal sMsg As String)

Dim sb As New StringBuilder
Dim oFormObject As System.Web.UI.Control

sMsg = sMsg.Replace("'", "\'")
sMsg = sMsg.Replace(Chr(34), "\" & Chr(34))
sMsg = sMsg.Replace(vbCrLf, "\n")
sMsg = "alert(""" & sMsg & """)"

sb = New StringBuilder
sb.Append(sMsg)

For Each oFormObject In Me.Controls
If TypeOf oFormObject Is HtmlForm Then
Exit For
End If
Next
Controls.AddAt(Controls.Count, New LiteralControl(sb.ToString()))
End Sub

Protected Sub ButtonSubMana_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bntSubMana.Click
Dim ds1 As New Data.DataSet
Dim obj As Businesslayer.TimeSheet = New Businesslayer.TimeSheet
Dim NumberOfBoxes As Integer
Dim WhichBox As Integer


'Dim WeekN As Date

NumberOfBoxes = Integer.Parse(WhichBox)
Dim rows(NumberOfBoxes) As Integer
'Dim Repeater1 As Repeater

For WhichBox = 0 To NumberOfBoxes
'Dim ImageButton1 As ImageButton
Dim txtWeekNumber As TextBox = CType(Repeater1.Items(WhichBox).FindControl("txtWeekNumber"), TextBox)
Dim txtDate As TextBox = CType(Repeater1.Items(WhichBox).FindControl("txtDate"), TextBox)
Dim cmbProjectName As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbProjectName"), DropDownList)
Dim cmbClientSite As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbClientSite"), DropDownList)
Dim cmbProjectManager As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbProjectManager"), DropDownList)
Dim cmbProjectMember As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbProjectMember"), DropDownList)
Dim cmbCategory As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbCategory"), DropDownList)
Dim cmbOccupation As DropDownList = CType(Repeater1.Items(WhichBox).FindControl("cmbOccupation"), DropDownList)
Dim txtHours As TextBox = CType(Repeater1.Items(WhichBox).FindControl("txtHours"), TextBox)
Dim CheckBox1 As CheckBox = CType(Repeater1.Items(WhichBox).FindControl("CheckBox1"), CheckBox)
Dim txtDescription As TextBox = CType(Repeater1.Items(WhichBox).FindControl("txtDescription"), TextBox)


Dim errors As ArrayList = New ArrayList
Dim rptErrors As New ValidationSummary

If txtDate.Text = "" Then
errors.Add(New validation("Please Enter your Date"))
End If
If cmbProjectName.SelectedItem.Text = "" Then
errors.Add(New validation("Please select A ProjectName"))
End If
If cmbClientSite.SelectedItem.Text = "" Then
errors.Add(New validation("Please select A ClientSite"))
End If
If cmbProjectManager.SelectedItem.Text = "" Then
errors.Add(New validation("Please select A ProjectManager"))
End If
If cmbCategory.SelectedItem.Text = "" Then
errors.Add(New validation("Please select A Category"))
End If
If cmbOccupation.SelectedItem.Text = "" Then
errors.Add(New validation("Please select A Occupation"))
End If
If txtHours.Text = "" Then
errors.Add(New validation("Please Enter your Hours"))
End If
If txtDescription.Text = "" Then
errors.Add(New validation("Please Enter you Job Description"))
End If
If errors.Count > 0 Then
'rptErrors.DataSource = errors
rptErrors.DataBind()
rptErrors.Visible = True
Else
End If
obj.addTimesheet(Session("Id"), cmbProjectName.SelectedValue, cmbClientSite.SelectedValue, cmbProjectManager.SelectedValue, txtDate.Text, txtWeekNumber.Text, Double.Parse(txtHours.Text), CheckBox1.Checked, cmbCategory.SelectedItem.Value, Session("Userid"), txtDescription.Text, "2")
cmbProjectName.Text = ""
cmbClientSite.Text = ""
cmbProjectManager.Text = ""
cmbCategory.Text = ""
txtDate.Text = ""
txtWeekNumber.Text = ""
txtDescription.Text = ""
txtHours.Text = ""
cmbCategory.Text = ""
Next

'Dim NumberOfEmails As Integer
'Dim NoRows As Integer
'Dim ArrayEmail(20)() As Array
Dim i As Integer
Dim EmailInfo As New Data.DataSet
Dim table As Data.DataTable
Dim row As Data.DataRow
'Dim column As Data.DataColumn
' For each table in the DataSet, print the row values.

For i = 0 To Repeater1.Items.Count - 1
Dim txtWeekNumber As TextBox = CType(Repeater1.Items(i).FindControl("txtWeekNumber"), TextBox)
Dim txtDate As TextBox = CType(Repeater1.Items(i).FindControl("txtDate"), TextBox)
Dim cmbProjectName As DropDownList = CType(Repeater1.Items(i).FindControl("cmbProjectName"), DropDownList)
Dim cmbClientSite As DropDownList = CType(Repeater1.Items(i).FindControl("cmbClientSite"), DropDownList)
Dim cmbProjectManager As DropDownList = CType(Repeater1.Items(i).FindControl("cmbProjectManager"), DropDownList)
Dim cmbProjectMember As DropDownList = CType(Repeater1.Items(i).FindControl("cmbProjectMember"), DropDownList)
Dim cmbCategory As DropDownList = CType(Repeater1.Items(i).FindControl("cmbCategory"), DropDownList)
Dim cmbOccupation As DropDownList = CType(Repeater1.Items(i).FindControl("cmbOccupation"), DropDownList)
Dim txtHours As TextBox = CType(Repeater1.Items(i).FindControl("txtHours"), TextBox)
Dim CheckBox1 As CheckBox = CType(Repeater1.Items(i).FindControl("CheckBox1"), CheckBox)
Dim txtDescription As TextBox = CType(Repeater1.Items(i).FindControl("txtDescription"), TextBox)
Dim EmailMessage As String


For Each table In EmailInfo.Tables
For Each row In table.Rows
' Response.Write(row(0) + " " + row(1))
Dim from As MailAddress = New MailAddress("timesheet@ecominstitute.com", Session("Name") & " " & Session("Surname"))
Dim recieve As MailAddress = New MailAddress(row(0), row(1))
EmailMessage = " Dear " & row(1) & "

" & _
"This is to notify that the TimeSheet for this week is as follows :

" & _
" " & _
"
DateProject NameClient SiteHourDescription
" & txtDate.Text & " " & cmbProjectName.SelectedItem.Text & "" & cmbClientSite.SelectedItem.Text & "" & txtHours.Text & "" & txtDescription.Text & "
"
Dim message As MailMessage = New MailMessage(from, recieve)
message.Subject = "Weekly TimeSheets For :" & txtProjectMember.Text
message.IsBodyHtml = True
message.Body = EmailMessage
'Dim copy As MailAddress = New MailAddress("Notification_List@contoso.com")
'message.CC.Add(copy)
Dim client As SmtpClient = New SmtpClient("srjhbex01", 25)
client.Send(message)
Next row
Next table
Next
UserMsgBox("Your Time-Sheet has been to the Manager for Approval")
End Sub


Protected Sub txtDay_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDay.TextChanged
Dim bntPrint As New Button
If txtDay.Text <= 0 Then
Repeater1.Visible = False
UserMsgBox("Please Enter the Number Greater than 0")
Else
Repeater1.Visible = True
bntSubMana.Visible = "True"

End If
End Sub

End Class
QuestionASP.NET variables and javascript Pin
The Onslaught22-Nov-07 5:04
The Onslaught22-Nov-07 5:04 
AnswerRe: ASP.NET variables and javascript Pin
Braulio Dez22-Nov-07 5:53
Braulio Dez22-Nov-07 5:53 
AnswerRe: ASP.NET variables and javascript Pin
The Onslaught22-Nov-07 6:11
The Onslaught22-Nov-07 6:11 
QuestionRender Control Pin
nzibi22-Nov-07 4:20
nzibi22-Nov-07 4:20 
AnswerRe: Render Control Pin
Braulio Dez22-Nov-07 5:57
Braulio Dez22-Nov-07 5:57 
QuestionLike MaskTextBox Pin
A AntonySP22-Nov-07 2:39
A AntonySP22-Nov-07 2:39 
AnswerRe: Like MaskTextBox Pin
N a v a n e e t h22-Nov-07 3:06
N a v a n e e t h22-Nov-07 3:06 
AnswerRe: Like MaskTextBox Pin
Pete O'Hanlon22-Nov-07 3:21
subeditorPete O'Hanlon22-Nov-07 3:21 
AnswerRe: Like MaskTextBox Pin
Michael Sync22-Nov-07 4:17
Michael Sync22-Nov-07 4:17 
GeneralRock Bottom Pin
Malcolm Smart22-Nov-07 1:54
Malcolm Smart22-Nov-07 1:54 
GeneralRe: Rock Bottom Pin
N a v a n e e t h22-Nov-07 2:03
N a v a n e e t h22-Nov-07 2:03 
GeneralRe: Rock Bottom Pin
Paddy Boyd22-Nov-07 2:29
Paddy Boyd22-Nov-07 2:29 
JokeRe: Rock Bottom Pin
Vasudevan Deepak Kumar22-Nov-07 19:29
Vasudevan Deepak Kumar22-Nov-07 19:29 
GeneralRe: Rock Bottom Pin
Shujaat Ullah Khan22-Nov-07 18:23
Shujaat Ullah Khan22-Nov-07 18:23 
QuestionData transfer from webserver to localserver Pin
krishnaveer22-Nov-07 1:46
krishnaveer22-Nov-07 1:46 
AnswerRe: Data transfer from webserver to localserver Pin
DigiOz Multimedia22-Nov-07 5:00
DigiOz Multimedia22-Nov-07 5:00 
Question.sln file Pin
BINOVAR22-Nov-07 1:28
BINOVAR22-Nov-07 1:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.