473,396 Members | 1,871 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,396 software developers and data experts.

Iterating through HTML Controls from codebehind

RSH
Hi,

I have a situation where I have 10 HTMLFileInput controls on my aspx page.
They are all named UploadedFile1,UploadedFile2...

Now on postback I am trying to construct a loop to check for values in those
fields. I can't for the life of me figure out how to do this. i tried:

Dim j As Integer = 0

For j = 0 To 10

If Len(Trim(Request.QueryString("UploadedFile" & j))) 0 Then

UploadFile(FindControl("UploadedFile" & j), CompanyID, ReturnId)

End If

Next

Everything comes back as nothing

Dim j As Integer = 0

For j = 0 To 10

If Len(Trim(Findcontrol("UploadedFile" & j))) 0 Then

UploadFile(FindControl("UploadedFile" & j), CompanyID, ReturnId)

End If

Next

Everything comes back at nothing.

What is the correct way to get at the value of the controls (remember they
are HTML Controls).

Thanks,

Ron


Sep 11 '06 #1
1 1341
Ron,

Just a quick guess:
Request.Form["UploadFile" & j]

Does that work?

Rob

"RSH" <wa*************@yahoo.comwrote in message
news:eI****************@TK2MSFTNGP06.phx.gbl...
Hi,

I have a situation where I have 10 HTMLFileInput controls on my aspx page.
They are all named UploadedFile1,UploadedFile2...

Now on postback I am trying to construct a loop to check for values in
those fields. I can't for the life of me figure out how to do this. i
tried:

Dim j As Integer = 0

For j = 0 To 10

If Len(Trim(Request.QueryString("UploadedFile" & j))) 0 Then

UploadFile(FindControl("UploadedFile" & j), CompanyID, ReturnId)

End If

Next

Everything comes back as nothing

Dim j As Integer = 0

For j = 0 To 10

If Len(Trim(Findcontrol("UploadedFile" & j))) 0 Then

UploadFile(FindControl("UploadedFile" & j), CompanyID, ReturnId)

End If

Next

Everything comes back at nothing.

What is the correct way to get at the value of the controls (remember they
are HTML Controls).

Thanks,

Ron


Sep 12 '06 #2

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

Similar topics

2
by: Hawk | last post by:
I have a custom menu control that I am creating using C#. I am rendering HTML from a StringBuilder in my control to add the needed JavaScript to the HTML output. I need to have the JavaScript...
6
by: trinitypete | last post by:
I have a user control that is basically a login dialogue. If I add the user control to webpage1, can I access the properties directly from C# codebehind, or do I have to access the properties from...
2
by: exshige | last post by:
I read from some book that you can actually on any tag in the html page put a onClick or something and assign it with the sub/function name that is in the codebehind. I tried but it say name...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: mca | last post by:
Hi everyone, I'm new to asp.net and i have a question about separating the html code from the programming code. i have an unknown numbers of entries in my table. I want to make a hyperlink...
4
by: tma | last post by:
I'm trying to retrieve values for my HTML from the Codebehind file and I'm unclear how to accomplish this. For example: <INPUT TYPE="hidden" NAME="amount" VALUE="xx"> How do I populate the...
9
by: Craig Andrews | last post by:
Hello, How do I access HTML CheckBoxs in the codebehind section of an ASP.NET program? In the old Interdev days one would: For i = 1 to Request.Form("CheckBox").Count if...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.