How Many Elements In An Array
Like in PHP you can use:
PHP Code:
$length = count($array);
Is there an ASP alternative? I'm using VB4.
Like in PHP you can use:
PHP Code:
$length = count($array);
Is there an ASP alternative? I'm using VB4.
i have one array of string and it contains 51 elemnts. it will get bigger and bigger but i want to read these array ellments from a text file.this is possible?
View Replies View RelatedI'm inserting elements into a 2-dimensional array from a form like this..... Code:
View Replies View Relatedthis may seem like a very basic question but one I could do with having answered!! I have an the following array TableArray(20, 100) and I need to start off with all elements in the array to hold the value 1. Is there a simple way of doing this or do I have to loop throuugh the array setting the values?
View Replies View Relatedi am able to read from a txt file and this is the code:
View Replies View Relatedi'm having a bit of trouble inside a loop displaying values for session variables that are wrong the code thats not working looks like this:
Code:
Response.Write"<tr><td>Answer "&counter&"</td> <td><input type=text maxlength=50 id=option"&counter&" size=50 title=answer"&counter&"value value='"=session("answer"&counter&"")"' name=answer"&counter&" /></td></tr>"
its enclosed in a loop with the counter element increasing to the given total and its meant to set the value of the text box (the session variable) to display the value.
in plain ASP and html all thats needed for the normal input box to display a session value is :
Code:
value="<%=Session("variable")%>"
I'm using Visual Web Developer Express 2005 to get me started - probably a bad idea I'm told. Anyhow, I've connected a drop-down list ('Components') to a column in a SQL DB, and, upon selection, the resulting gridview is being generated as I hoped (with the corresponding 'Applications').
However, I would like each of these resulting rows in my gridview to be "clickable" as a hyperlink so that I can display each of the applications details on another page. If someone could enlighten me as to whether/not this is even possible, and if so, how?
I am aware of how to create elements, attributes on the fly with the Microsoft.XMLDOM however I was wondering if anyone had any examples of how you could extend this to insert the content created in to an existing node.
Eg
<root>
<section> <- INSERT ELEMENT HERE -> </section
</root>
In my ASP page I have a set of menus on the left side and list boxes just on its right side. Whenever I click on a menu and the submenu appears it gets hidden under the listboxes and cannot be read properly.
The page design cannot be changed at this point of time and the listboxes cannot be moved to any other position of the page. So is there any property or function so that I can make my menu elements appear above the listboxes.
I have this form that collects text values and I use VBCrLf as delimiters to tell one element from another. Sometimes, I get several empty elements. Is there a way to remove those elements?
View Replies View RelatedI have an html file where I put a date (im_lixis) in a form and I also have an asp file that checks this date and if this date exists in my table timologisi in ms access I want to display all the recordsets with this date.
I dont know what I'm doing wrong... but when I run it.. it takes some time and then tells me that I got out of time ... without telling me if I have something wrong in some line Code:
Does anyone know how to get the number of input tags contained in a div tag? I am trying to build a dynamic list of checkboxes from a database and I don't know how many checkboxes i have until the form is built to do some validation.
Probably using client-side javascript - something like
var obj = document.all.tags("div").item(0)
var mydiv = obj.id.indexOf("chk0100")
But I am not sure how to specify the name of the input tag.
I dont know what the above statement does.
Is there any way to extract the form elements' value without submitting the form. I want the value of the form element be used in the script written in the same page without submitting the form.
View Replies View RelatedI would like to remove individual elements from a vbscript array without just blanking out that element. Is this possible?
View Replies View RelatedWhy won't this code work - the "id" fields are autonumbers
Code:
<select size="1" name="Agent" tabindex="">
<option value="Select">Select Owner</option>
<%
x = rs("id")
Do While NOT rs2.eof
y = rs2("id")
Response.Write "<option value='" & rs2("id") & "'"
If x = y Then Response.Write " Selected" End If
Response.Write " >" & rs2("first") & " " & rs2("last") & "</option>" & vbCrlf
rs2.MoveNext
Loop
%>
</select>
I have a master page with one Content Pane, on the left is a Nav bar that has a Login View in it so if the person is an Admin they see on thing if they arn't they see another.
For the regular users I have a gridView that displays a lists of dates pulled from the database. I want to access the selected value there normally if it was inside my content page i could just do Code:
EventID = ((Label)GridView1.SelectedRow.Cells[1].FindControl("Label1")).Text;
But now except GridView on is no longer in my Content Pane but on my Master Page how do I reference to it?
Here is my input box which has the employee id.
<input type=hidden name=empid value=40578>
In my SQL query, I would like to call the value of "empid" textbox in my SQL Query. How can I do this? Code:
I'm using MSXML2.DOMDocument.4.0 to create an XML document on-the-fly.
Everything is going great except that at some point I need to create an empty XML element with a start and an end tag, not only an end tag.
Eg. I need to create <Signature></Signature> instead of <Signature />
However, MSXML2.DOMDocument.4.0 refuses to create the empty element with a start and an end tag.
It insists on creating only the closing end tag, even if I try to set text value for the element to "". Code:
My client wants File Uploading in ASP that i can do but the requirement says that i should have one FORM FILE FIELD first to browse the file to upload.
and the moment i click the browse button of first FILE FIELD, a second FILE FIElD is generated beneath it and when the user clicks on the second Browse button it generates the third and this process goes on. Untill the user clicks the upload button to upload all the files.
I know this sounds stupid as it is much easy to provide 5 Form File fields and if user wants more then another five is added on another page, but ti is clients requirement .
I dont know how to dynamically Generate Form FILE FIELD for browsing file to upload AT RUN TIME .
I have a problem with reading data from a form element(s). Instead of using a Type=Submit, I have chosen to use a hyper-link to call a select case structure which adds, edits or deletes a record depending on the contents of the action property.
here is a couple of lines showing two text box's in my form, directly following is the href that passes data to the select statement.
<td><input type="text" name="Desc" id="descid" size="55" /></td> <td><input type="text" name="Units" id="Text1" size="4" /></td> </form>
<td align=right><a href="<%= SCRIPT_NAME %>?action=add&jdate=<%= dDate %>"><img src="Web-add.bmp" alt="Add" width="63" height="25" border="0" /></a></td>
I would like to include the values from the form elements in the action string but have so far drawn blanks. I have attached the full form code.
I have to continuously download the same web page on our IIS server. It is
important to always download a fresh page from the server including not only
the .asp page itself but all the .gif and .jpg files associated with that
page. We need to measure statistical info on how long it takes to download.
If the page is stored in the client machines internet cache that would be a
problem.
Now I know how to add the following to the main .asp page to insure a fresh
copy is always downloaded of this page itself.
<% Response.Expires = -2000 %>
When I look at the client machines cache folder it does show that the main
..asp page has expired an hour ago. However all the .gifs and .jpgs , etc downloaded with the main .aps page show the value Expire: None which I conclude means that these pieces are not redownload each time we get the main .asp page.
Up till now we have been using a perl script to try and erase the cache
before each download. This works sometimes but not all the time.
Is there any way to force the .gifs, .jpgs etc. to have to download fresh
each time just like I was able to get the main .asp page to redownload with
<% Response.Expires = -2000 %>
I asked a question earlier about creating dynamic pages.
I want to know if its possible to create dynamic form elements based on a condition equating to true.
e.g. as you could have dynamic texts when a condition is true.
Could i have dynamic form elements when a condition is true
e.g. response.write(create radio button)
or create combo box etc
or how is it done ?
How can I check to see if a form element exists on a form that has been submited? I have a load of checkboxes called box1 box2 box3 etc. I want to create a loop which gets the value of the box (checked or not), but there is an unknown amount of boxes so I want a loop:
Do While (box(i) exists)
check value
i=i+1
Loop
how do I do this?
I wrote a sever side form valiation script that loops through the form elements building a string in the process. If you submit the form without filling in any fields you will get the error message in read at form's top. Look how the fields in the error message are completely out of order. Why is this? Code:
View Replies View RelatedI am designing a website to records details of people who visit our company. When entering a visitors details I wish to record the company that they work for, to save the user time a dropdown list of companies is populated dynamically from the backend (Oracle) database. In the event of a company not existing in the database the user would have to go to the page to add a new company and then come back to the form meaning that they would lose anything they have already entered.
What I am trying to do is to enable the user to click on a link which will bring up a pop up window into which they may enter the new company, on closing down this popup the new company will be added to the dropdown list.
So far I have got the popup to display and to accept the user input and I have inserted this new company name into the database with a unique reference number generated by a sequence and before_update trigger. The following code is for the popup window and accepts user input, writes it to the database and closes the window: Code:
When you submit the form you can see I am trying to get the each row of the form elements into a format such that I can build multiple insert statements. Here is what I am working with:
<%
Dim x
For x = 1 to Request.Form.Count
Response.Write Request.Form.Item(x)
Next
Would I use some type of Mod operator on the value of x to determine my line breaks?
I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table
records are manipulated to control the permissions. Code:
I dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
I want to set up a simple database for my mom to enter her recipes into. I am going to use Access and ASP. In the database, I will have five fields (Recipe_ID, Recipe_Title, Recipe_Ingredients, Recipe_Instructions, and Recipe_Image). When my mom goes to enter a recipe, I want to ask the form to ask my mom how many Ingredients?
She will then specify "n" number of ingredients which will cause the page to display "n" number of text boxes. I can figure this part out myself. When the form is submitted, I want a script that will read and concatenate the ingredients, wrapping <li> tags around each one. The challenge for me is the reading of an undetermined number of form elements?
I have a form that is dynamically generated since it is populated with values retrieved from a database. The form can of course also be submitted, which is where I run into some problems.
Since I never know in advance what the length of the form (or for that matter what the different elements' names and values) will be I don't know how to write the code in "receive.asp" to retrieve all values from the form correctly without excess use of "request.....".
I shouldn't have to write requests for every single potential element name that is stored in the DB. Please note that the form can sometimes also contain radio buttons and check boxes, even though they are not present in this short example Code:
I am having a problem with a site that I am developing - my aim is for it to validate as XHTML Strict however, I am running into a couple of problems validating it; in my Response.Write ASP script, I am not including " 's to define page element tags as they keep throwing up errors in the page. Code:
View Replies View RelatedI want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?