473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Creating Server control's Control Array

Hello Every body,

I am tring to make an array of server controls with array
indes can change dynamically.
But I was not able to get the refrence of the control
outside the scope in which they were created.
can any body help me by sending a piece of sample code.
Regards
Vivek
Nov 18 '05 #1
2 1552
Can you show us the code that you have so far and how/where it is not
working?

"vivek" <pa*********@hotmail.com> wrote in message
news:08****************************@phx.gbl...
Hello Every body,

I am tring to make an array of server controls with array
indes can change dynamically.
But I was not able to get the refrence of the control
outside the scope in which they were created.
can any body help me by sending a piece of sample code.
Regards
Vivek

Nov 18 '05 #2


Hello Friend...

Below is the code I am Using. I a not able to get the refrence of the
Text boxes That I create Dynamically in the function
"TotalExperience()"..

The Code Starts now

Imports System
Imports System.Data.SqlClient
Imports System.Text
Imports System.IO
Imports System.Xml
Public Class frmResume2
Inherits System.Web.UI.Page

Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents txtCurrentSalary As
System.Web.UI.WebControls.TextBox
Protected WithEvents pnlText As System.Web.UI.WebControls.Panel
Protected WithEvents pnlCaption As System.Web.UI.WebControls.Panel
Protected WithEvents cboCompaniesWorkedIn As
System.Web.UI.WebControls.DropDownList
Protected WithEvents txtCertifications As
System.Web.UI.WebControls.TextBox
Protected WithEvents cboProfYearPassing As
System.Web.UI.WebControls.DropDownList
Protected WithEvents TxtProfInstitute As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtProfSpecilization As
System.Web.UI.WebControls.TextBox
Protected WithEvents cboProfCourse As
System.Web.UI.WebControls.DropDownList
Protected WithEvents cboYearPassing As
System.Web.UI.WebControls.DropDownList
Protected WithEvents txtInstitute As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSpecilization As
System.Web.UI.WebControls.TextBox
Protected WithEvents cboCourse As
System.Web.UI.WebControls.DropDownList
Protected WithEvents cmdLogOut As
System.Web.UI.WebControls.ImageButton
Protected WithEvents cmdClear As
System.Web.UI.WebControls.ImageButton
Protected WithEvents cmdSavenNext As
System.Web.UI.WebControls.ImageButton
Protected WithEvents cmdLogOut1 As
System.Web.UI.WebControls.ImageButton
Protected WithEvents cmdClear1 As
System.Web.UI.WebControls.ImageButton
Protected WithEvents cmdSavenNext1 As
System.Web.UI.WebControls.ImageButton
Protected WithEvents FilePath As
System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents Xml1 As System.Web.UI.WebControls.Xml

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

#Region "User Defined Controls"
Public Shared textBox1 As New Web.UI.WebControls.TextBox()
Public Shared Label1() As Web.UI.WebControls.Label
#End Region

Dim iclsConnection As New clsConnection()
Dim iSqlConnection As New SqlConnection()

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub cboCompaniesWorkedIn_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
cboCompaniesWorkedIn.SelectedIndexChanged
Dim idx As Integer
Dim Unit1 As New System.Web.UI.WebControls.Unit()
ReDim textBox1(3 * CInt(cboCompaniesWorkedIn.SelectedItem.Text))
AS Web.UI.WebControls.TextBox()
ReDim Label1(3 * CInt(cboCompaniesWorkedIn.SelectedItem.Text))
For idx = 1 To (CInt(cboCompaniesWorkedIn.SelectedItem.Text) *
3)
Dim textBox1 As New Web.UI.WebControls.TextBox()
textBox1.ID = "testbox" & CStr(idx)
pnlText.Controls.Add(textBox1)
textBox1.Width = Unit1.Percentage(100)
Label1(idx) = New Web.UI.WebControls.Label()
Label1(idx).Width = Unit1.Percentage(100)
Label1(idx).Height = textBox1.Height
If ((idx Mod 3) = 1) Then
Label1(idx).Text = "Company Name :"
ElseIf ((idx Mod 3) = 2) Then
Label1(idx).Text = "Designation :"
ElseIf ((idx Mod 3) = 0) Then
Label1(idx).Text = "Experience :"
End If
pnlCaption.Controls.Add(Label1(idx))
Next
End Sub

Public Function TotalExperience() As String

Dim companies, Experience, Designation As String
Dim Idx As Integer

For Idx = 1 To cboCompaniesWorkedIn.SelectedItem.Text
If Idx Mod 3 = 1 Then
companies = companies & textBox1(Idx).Text
End If
If Idx Mod 3 = 0 Then
Experience = Experience & textBox1(Idx).Text
End If
If Idx Mod 3 = 2 Then
companies = companies & textBox1(Idx).Text
End If
Next
End Function

Private Sub cmdLogOut1_Click(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles cmdLogOut1.Click
Session("ResumeLogin") = ""
Response.Redirect("../frmAfterPost.aspx?MSG = Thanks For Taking
Time TO PostYour Resume. We Will Get Back In Touch With You Soon")
End Sub

Private Sub cmdClear1_Click(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles cmdClear1.Click
cboCompaniesWorkedIn.SelectedIndex = 0
cboCourse.SelectedIndex = 0
cboProfCourse.SelectedIndex = 0
cboProfYearPassing.SelectedIndex = 0
cboYearPassing.SelectedIndex = 0
txtCertifications.Text = ""
txtCurrentSalary.Text = ""
txtInstitute.Text = ""
TxtProfInstitute.Text = ""
txtProfSpecilization.Text = ""
txtSpecilization.Text = ""
pnlCaption.Controls.Clear()
pnlText.Controls.Clear()
End Sub

Private Sub cmdSavenNext1_Click(ByVal sender As System.Object, ByVal
e As System.Web.UI.ImageClickEventArgs) Handles cmdSavenNext1.Click
If ValidatePage() Then
Exit Sub
End If
TotalExperience()
UpdateResume()
Response.Redirect("../frmAfterPost.aspx?MSG=Your Resume Has Been
Posted Successfully")
End Sub

Public Function ResumeExist() As Boolean
Try
Dim iSqlCommand As New SqlCommand()
Dim iSqlDataReader As SqlDataReader()
Dim sql, Exist As String

sql = "select Exist = case when email_address is null
then 'N' else 'Y' end from resume_master where email_address = '" &
Session("ResumeLogin") & "'"
iSqlConnection = iclsConnection.open(iSqlConnection)
iSqlCommand = New SqlCommand(sql, iSqlConnection)
Exist = iSqlCommand.ExecuteScalar()
If Exist = "Y" Then
ResumeExist = True
Else
ResumeExist = False
End If
Catch
ResumeExist = False
End Try
End Function

Public Function UpdateResume() As Boolean
Dim DoB As String
Dim iSqlCommand As New SqlCommand()
Dim sql, tmp As String
If iSqlConnection.State = ConnectionState.Closed Then
iSqlConnection = iclsConnection.open(iSqlConnection)
End If
tmp = UploadResume()
sql = "UPDATE [WhiteVisionSite].[dbo].[Resume_Master] " _
& " SET [Qualification]='" & cboCourse.SelectedItem.Text & "' ,
" _
& " [Specilization]= '" & txtSpecilization.Text & "', " _
& " [Institute]='" & txtInstitute.Text & "', " _
& " [Year_of_Passing]= '" & cboYearPassing.SelectedItem.Text &
"' , " _
& " [Professional_Qualification]='" &
cboProfCourse.SelectedItem.Text & "' , " _
& " [prof_Specilization]='" & txtProfSpecilization.Text & "', "
_
& " [Prof_Institute]= '" & TxtProfInstitute.Text & "', " _
& " [Prof_Year_Of_Passing]= '" &
cboProfYearPassing.SelectedItem.Text & "', " _
& " [Other_Qualification]= '" & txtCertifications.Text & "' , "
_
& " [Companies_Worked]= " &
cboCompaniesWorkedIn.SelectedItem.Text & " , " _
& " [Current_Salary]= " & txtCurrentSalary.Text & ", " _
& " [Detailed_Attached_Resume]= '" & tmp & "'" _
& " WHERE email_address = '" & Session("ResumeLogin") & "' "


iSqlCommand = New SqlCommand(sql, iSqlConnection)
iSqlCommand.ExecuteNonQuery()
'Dim sqlparam As New SqlParameter()
'sqlparam.Direction = ParameterDirection.Input
'sqlparam.ParameterName = "Detailed_Attached_Resume"
'sqlparam.DbType = SqlDbType.Image
'sqlparam.Value = UploadResume()
'iSqlCommand.Parameters.Add(sqlparam)
End Function

Public Function ValidatePage() As Boolean
Dim ExceptionString As String
Dim iclsUtility As New clsUtility()
If (cboCourse.SelectedIndex = 0) Then
ExceptionString = "* Please Select Date Of Qualification"
ValidatePage = True
End If
If (txtInstitute.Text = "") Then
ExceptionString = ExceptionString & "\n" & "* Please Enter
Institue"
ValidatePage = True
End If
If (txtCurrentSalary.Text = "") Or (Not
(IsNumeric(txtCurrentSalary.Text))) Then
ExceptionString = "* Please Enter Your Curent salary"
ValidatePage = True
End If
If ValidatePage = True Then
iclsUtility.ShowMessage(ExceptionString)
End If
End Function

Public Function UploadResume() As String
Dim FileName As String
Dim BR As BinaryReader
Dim Fs As FileStream
Dim tmp As String
Dim objstream As Stream
Dim INTLENGTH As Integer
Dim bytData() As Byte
Dim iconver As Convert

INTLENGTH = FilePath.PostedFile.ContentLength
ReDim bytData(INTLENGTH)
objstream = FilePath.PostedFile.InputStream
objstream.Read(bytData, 0, INTLENGTH)
tmp = Convert.ToBase64String(bytData)
Return tmp
' Dim iXmlReader As New XmlReader(objstream)
'Return iXmlReader

'Fs = New FileStream(FilePath.Value.ToString, FileMode.Open)
'BR = New BinaryReader(Fs)
'tmp = BR.ReadString

'UploadResume = tmp
End Function
End Class
Please See if You can Help me out.
Regards
Vivek
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ken Varn | last post by:
I am just starting the process of creating ASP.NET server controls. I have created controls for .NET applications, but have just started with ASP.NET. I am a little confused about some areas that...
6
by: Glenn Owens | last post by:
I have an ASP.Net page on which there are serveral static controls (listboxes, radiobuttonlist and textboxes). These controls are used to create criteria from which the code-behind will dynamically...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
17
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.