tgreer 189 Made Her Cry Team Colleague

While I won't prevent anyone from taking this challenge on, it really isn't the purpose of this forum to teach a top-down, from scratch HTML course.

Years ago, I learned from a book in the "Visual QuickStart" series by Elizabeth Castro. I'm sure it's been updated several times and is still a helpful guide.

As you learn, and have specific questions or areas of concern, you're welcome to discuss them here.

tgreer 189 Made Her Cry Team Colleague

That's a lot of code to debug... forgive me for not being more helpful, but if you're new at this, then how did you write all this code? If you DIDN'T write the code, then perhaps you'd get better support from whomever did?

If I have time this weekend, I may take a closer look.

tgreer 189 Made Her Cry Team Colleague

You can add a small script to the head portion of each of your child/inner pages. This script will check to see if it is inside a frame, and if not, redirect back to the home page.

<script language="javascript" type="text/javascript">
if (top == self)
{
  self.location.href = "index.htm";
}
</script>

This assumes that your main page is named "index.htm".

tgreer 189 Made Her Cry Team Colleague

Why not post the error, first?

tgreer 189 Made Her Cry Team Colleague

Firefox itself will help. Use the "JavaScript Console" under the Tools menu to see the errors.

tgreer 189 Made Her Cry Team Colleague

No. You can let them download it, adjust it in their copy of Excel, and upload it back.

tgreer 189 Made Her Cry Team Colleague

Upload to your email address? Hmmm.

You can have the user upload any file at all, by placing a file upload element on your page.

<input type="file">

There are some optional attributes, such as ID or NAME, and SIZE (referring to the size of the textbox, not the size of the file.

The form must be properly encoded to allow files to be posted, add the enctype="multipart/form-data" key-value pair to your FORM element.

Once it's on the server, you'd use whatever server-side language you use to process the file, which could include emailing it somewhere.

tgreer 189 Made Her Cry Team Colleague

You're posting in a thread that's over a year old... and I don't see a question in your post. Would you mind starting a new thread, and ask your question, if you have one, there?

tgreer 189 Made Her Cry Team Colleague

Not sure I understand the problem. Hitting "Refresh" will, well, refresh the page. No value would be expected to remain, every element would naturally go back to the initial, default values.

tgreer 189 Made Her Cry Team Colleague

Impossible to answer, given the complete lack of detail. What homepage? Where? Which browser?

tgreer 189 Made Her Cry Team Colleague

Re: images in the Google Ads - always trace the problem back to its source:

The forum has Google Ads in it!

tgreer 189 Made Her Cry Team Colleague

There are DOM methods equivalent to getElementById, such as .getFirstChild, .getChildNodes() and so on. Those are what you need to use. Web search for those terms, you should find lots of tutorials, such as this one: http://www.opensourcetutorials.com/tutorials/Client-Side-Coding/JavaScript/javascript-document-object-model/page4.html

tgreer 189 Made Her Cry Team Colleague

If you're using Internet Explorer, you're probably getting a security alert, since IE won't run JavaScript on files loaded locally.

However, from your description, I would say Comatose is probably closest to the truth: your browser is treating it like it's a text file, not an HTML file.

Are you sure the file has .html as the extension, and not .doc or .txt?

tgreer 189 Made Her Cry Team Colleague

And if this isn't the case, and the file really is an HTML file with a ".html" extension, simply double-clicking it should open it in your default browser.

If not, then open the browser, and drag the file into the browser.

tgreer 189 Made Her Cry Team Colleague

When the user submits the form, the values from the form will be inside the Response object. You can get the values there, if you like.

The ASP.NET Page Lifecycle goes through a series of discrete steps, well-documented on my site and elsewhere on the web.

Any static web controls, meaning, those controls that you built into the page via the Visual Studio toolbox/designer, are re-created, and the values from the Response object bound to them as part of the LoadPostBackData stage in the lifecycle.

If these textboxes are dynamically created, via some server-side event procedure, then the controls need to be re-created, by you, in every code path that might need them and their values, prior to the LoadPostBackData stage, so that they can be properly bound.

Thus my original question, which you never answered and isn't displayed in your code:

So... where are these textboxes actually created?

Also, examine your code-path. How are you preventing your step "1" from occuring when the user submits the form? From the code you posted, evidently you're calling "filldata" on Page_Load. Thus, everytime you run your code, you're going to ignore what the user entered, and instead go get what's currently in the database. I hinted at that in my first response, as well.

Before I can help any further, you need to re-read and think through the answers you've already been given.

tgreer 189 Made Her Cry Team Colleague

I didn't quite follow your question. You say you're having trouble "passing hidden values", but the code you've shown is for creating hidden input elements.

You'd simply do that in another, separate, loop.

tgreer 189 Made Her Cry Team Colleague

Agreed - something very strange. The error might be in the "main.html" file you're referencing but haven't shown.

tgreer 189 Made Her Cry Team Colleague

Sorry, you cannot. This is by design: a script on one page should never be allowed to close a page on another domain wtithout first asking the user. This behavior is built into the browser itself.

tgreer 189 Made Her Cry Team Colleague

I'm not quite sure I understand. Does my 3-column layout at www.tgreer.com match your criteria?

tgreer 189 Made Her Cry Team Colleague

Yes. You can apply color and other formatting, even within code blocks.

tgreer 189 Made Her Cry Team Colleague

Please use the forum's code tags when posting code samples!

tgreer 189 Made Her Cry Team Colleague

That's completely up to you. You have enough now to learn the mechanism and finish it on your own.

tgreer 189 Made Her Cry Team Colleague

I assure you this works. I have no idea what "getelement" means, sorry.

Here's the most simplified test version I can make for you:

<html>
<head>
<script type="text/javascript">
function startWord(x)
{
  var commandParms = document.getElementById(x).value;
  alert(commandParms);
}
</script>
</head>
<body>
<form>
<input id="txt" type="text" value="123" />
<input id="btn" type="button" value="Click" onclick="startWord('txt')" />
</form>
</body>
</html>
tgreer 189 Made Her Cry Team Colleague

No, the server wouldn't process that... it's JavaScript, which would run on the client.

Change name="par_1" in the input text element to id="par_1" .

tgreer 189 Made Her Cry Team Colleague

I see. Well, you're passing in a value to the function, correct? Is that value you want to "pass" to the activeX object? I see you're executing the method with "commandParms", but you're never setting "commandParms" equal to anything. Should it contain the value you pass to the JavaScript function?

Okay, I'm going to assume that you want commandParms = "123".

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
<!--
function startWord(x)
  {
commandParms = document.getElementById(x).value;
   var oShell = new ActiveXObject("Shell.Application");
    var commandtoRun="C:\\Karan\\Automation.exe";
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
  }
  //-->
</script>
</head>
<body>
<form>
<input type="text" name="par_1" value="123">
<input type="button" value="Click me!" onclick="startWord('par_1')">
</form>
</body>
</html>
tgreer 189 Made Her Cry Team Colleague

It's a web development language from Microsoft. You use it to develop web applications. It consists of a large set of objects. The objects have properties and/or methods which can be manipulated at design or run time (dynamically).

ASP.NET works in conjuction with the web server to process these objects and render a response stream for the browser.

tgreer 189 Made Her Cry Team Colleague

Please use the forum's CODE tags when posting.

JavaScript runs on the client. ASP runs on the server. You cannot "pass" variables between them, per se.

The only time ASP runs is when a REQUEST is sent to the web server, either a GET or a POST.

The way you send values to an ASP form is by adding a QueryString to your GET Requests, or by populating form values for your POST Requests (or, "form submits").

tgreer 189 Made Her Cry Team Colleague

Yep. it's invisible on most LCD's.

tgreer 189 Made Her Cry Team Colleague

I stand corrected. If Dreamweaver allows server- and client-side coding, then yes, that would make it a Developer's tool.

I do stand solidly by the distiction between a Web Developer and a Web Designer, however.

tgreer 189 Made Her Cry Team Colleague

If you don't know a server-side language, you're not a Web "Developer". If you want a job as a Web Developer, you need to become a Developer, which by definition means learning a programming language. Dreamweaver is absolutely irrelevant to that.

If you are great at HTML & CSS, and have artistic talent, you might qualify as a Web Designer.

tgreer 189 Made Her Cry Team Colleague

Right... anything you COULD do would necessarily make your overall load time slower. Get a faster host.

On some e-Commerce systems I've designed, where there is a significant task (such as generating a print-quality PDF proof), I pre-load a "please wait" message or GIF, with visibility set to hidden. When the page submits, the submit handler/validation routine first toggles the visiblity of this, then submits.

tgreer 189 Made Her Cry Team Colleague

Hello. Please use the forum's code and formatting tags, and avoid things like "######" in your posts.

What have you already tried? Are you familiar with JavaScript's events and event handlers? You might investigate using the "onkeypress" or related event handlers. The particular keycode being generated will be a property of the Event object.

You can set focus to any particular element by using the "focus()" method.

So: research "JavaScript", onkeypress", "focus" and "Event". Web Searches might be "JavaScript Event object" and "JavaScript onkeypress", etc. Apply what you discover, try it, and come back with any specific questions.

tgreer 189 Made Her Cry Team Colleague

Ok. I'll try to help, if you try to use apostrophes in your posts. Deal?

You set cookies using the "document.cookie" object. The arguments are name-value pairs:

document.cookie =
  'cookieName=cookieValue; expires=Thu, 23 Feb 2006 20:47:11 UTC; path=/'

Three pairs: the cookie name and value, the expiration date-time, and the path.

To read the cookie:

var x = readCookie('cookieName')
if (x)
{
	[do something with x]
}

Try that, make sure you can at least write and read the cookie. You do know how to at least create an HTML document with scripts, right?

tgreer 189 Made Her Cry Team Colleague

I'd like to close this thread - it's drifting too far. Please start a new thread in the PHP forum.

tgreer 189 Made Her Cry Team Colleague

Yes, it can be done, using the techniques I've already described. What specifically have you tried? At what point does it fail? You need to show us what you've already tried, what you already know, so we can help you properly.

As I said, there are lots of examples of how to read/write cookies with JavaScript, and the other object you'll need is the "timer" object.

tgreer 189 Made Her Cry Team Colleague

Note, though, that completely removes the link, instead of just making it invisible. A subtle difference. Try using "style.visibility=visible" and "style.visibility=hidden" instead. Compare the differences, and decide which you'd like to use, "visibility" or "display".

tgreer 189 Made Her Cry Team Colleague

You can certainly write cookies with JavaScript, yes. A simple web-search should reveal hundreds of examples. You can also use the JavaScript "timer" object to periodically check to see if a cookie has expired. So yeah, this could be done. However, it won't be secure.

tgreer 189 Made Her Cry Team Colleague

CSS declarations don't go in your scripts. They are in a separate "style" section entirely. However, your script can change a style.

tgreer 189 Made Her Cry Team Colleague

You can pack as many JavaScript statements as you like into a single function.

tgreer 189 Made Her Cry Team Colleague

WOW - Thanks alot for all the help so far!!! :lol:

So I would put:

document.getElementById("myMessage").innerHTML = "Thank you, You may now click " + "<a href='download.html'>here</a>" + " to proceed to the " + "<a href='download.html'>download</a>" + ".";

to make a link to the downloads page.

That should work. Test it. You can place any string as the value of ".innerHTML", so play with your tags etc. until you get what you want.

1) How do I make the script write the "proceed to download" text even when there are -1 clicks needed or -2 etc.

You would alter this line if (counter != 0) . The part inside the parantheses is called an "expression". Right now the expression tests to see if counter is not equal to 0. You would change the expression to test to see if counter is less than or equal to 0: if (counter <= 0) .

2) Would it be possible to open the new windows in the background - so my page will stay on top until the user clicks on the tab at the bottom of the screen to view the page.

Maybe, but don't. Users don't expect that, and doing anything contrary to what users expect irritates them. Research the "onblur" event handler and the "focus()" method. It might be possible to add something to your body tag: <body onblur="self.focus();"> I haven't tested that, you'll need to experiment.

3) Will this script work in all browsers, or will …

tgreer 189 Made Her Cry Team Colleague

Next is to open a window. In this version, we add back our HREF's so the links actually go somewhere.

Notice the new onclick attributes. It now looks like: return link_click(this); What that does is tell the link that we expect the function to "return" a true or false. If a "false" is returned, then we "cancel" the click. Why? Because we will do the navigation in our script, we don't want the actual hyperlink to do what it would normally do: navigate to the page.

We also pass in a parameter called "this". "This" is a special keyword that passes in the current object, which is our hyperlink. Notice the function? It will store "this" in a variable, "x".

We added a "window.open()" statement. You need to research that. We pass in a URL. What URL? x.href, the URL value from the hyperlink's HREF attribute.

That will open the page in a new window.

Lastly, we return false, to cancel the hyperlink click. If we didn't do that, our main page would ALSO navigate, which we don't want to do.

<html>
<head>
<script type="text/javascript">

var counter = 3;
function link_click(x)
{
  counter--;
  if (counter != 0)
  {
	document.getElementById("myMessage").innerHTML = "Please click on at least " + counter + " of the links below.";
  }
  else
  {
	document.getElementById("myMessage").innerHTML = "Proceed to download.";
  }

  window.open(x.href,'');
  return false;
}

</script>
</head>
<body>

<p id="myMessage">Please click on at least 3 of the links below.</p>

<a href="
       
DanceInstructor commented: Above and beyond the call of duty :P +1
tgreer 189 Made Her Cry Team Colleague

You can't technically "call"... Umm. I realized I have no way of intelligently answering your question.

This "vb program" you have, is it VB.NET? Is it ASP? Is it even a web application?

Listen, all a web browser can do, really, is submit a "Request" to a web server. The web server may or may not call a program (written in any number of web development languages) to process the Request and generate a Response. JavaScript doesn't alter that equation in the least. All it does is interact with the client document and browser. It can't "call" anything on the server.

tgreer 189 Made Her Cry Team Colleague

You're on the right track... "document.write()" is deprecated, meaning, it's old and newer browsers may eventually stop supporting it. I doubt it, frankly, but it's best to use a newer method. So, onward to step 2.

One such method is to use the .innerHTML property of an element. Note, this works in all major browsers, but isn't technically part of an HTML specification. I'm showing it to you because it makes the concept very clear. In the final script, it should be changed to one of the DOM methods. Just file that away for "stuff to learn later".

Consider this version of our test page:

<html>
<head>
<script type="text/javascript">

var counter = 3;
function link_click()
{
  counter--;
  if (counter != 0)
  {
	document.getElementById("myMessage").innerHTML = "Please click on at least " + counter + " of the links below.";
  }
  else
  {
	document.getElementById("myMessage").innerHTML = "Proceed to download.";
  }
}

</script>
</head>
<body>

<p id="myMessage">Please click on at least 3 of the links below.</p>

<a href="#" id="link_01" onclick="link_click();">Hyperlink 1</a><br />
<a href="#" id="link_02" onclick="link_click();">Hyperlink 2</a><br />
<a href="#" id="link_03" onclick="link_click();">Hyperlink 3</a><br />

</body>
</html>

We've added a paragraph. Our script decrements the counter, and dynamically changes the text of the paragraph, using the value of our counter inside the text.

If the counter reaches zero, we change the paragraph completely.

You should research "document.getElementById()" and ".innerHTML", as they are the keys to this functionality.

Digest that, and we'll move on to step 3.

tgreer 189 Made Her Cry Team Colleague

Figured it out. I'll write this up, eventually. The answer is to create a public class with two properties, the id of the record needed for the query to the details, and the UniqueID of the Placeholder for a pariticular row/item in the parent.

Store these objects in a List<> generic, marked as Serializable. Store the List object in ViewState.

Then, loop through the List, building the Repeater dynamically for each item in the List.

tgreer 189 Made Her Cry Team Colleague

So many of the C#/ASP.NET threads I start end up with me just talking to myself. Hopefully, everyone is following along diligently, just waiting for a chance to jump in. THIS IS YOUR CHANCE!

I've given up on GridView. I'm using Repeaters, instead. I have one "static" Repeater, coded to display the "Parent" rows. There is a LinkButton element in the Repeater. There is also a PlaceHolder.

When the LinkButton is clicked, I dynamically create a second Repeater, completely in code, bind it in code, and add that Repeater to the PlaceHolder. This dynamic Repeater contains all the "Detail" rows.

The issue I need some help with is, re-creating all of the dynamic Repeaters which the user has chosen to display. I fully understand the issue... the codepath only creates one dynamic Repeater on PostBack. I need some mechanism to re-create all previously rendered Repeaters. Session?

Note: this renders very ugly for now. First comes logic, then comes StyleSheets

Here is the declarative syntax for the page.:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="show_tsr.aspx.cs" Inherits="show_tsr" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
	<title>Untitled Page</title>
	<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<form id="form1" runat="server">
	<div>


<table>
  <thead>
  <tr>
	<th>TSR #</th><th>Subject</th><th>Department</th><th>Application</th>
  </tr>
  </thead>
  <asp:Repeater ID="rptrIssue" runat="server"  OnItemCommand="rptrIssue_ItemCommand">
	<ItemTemplate>
	<tr>
	  <td><%# DataBinder.Eval(Container, "DataItem.issue_id") %></td>
	  <td><%# DataBinder.Eval(Container, "DataItem.subject") %></td>
	  <td><%# DataBinder.Eval(Container, "DataItem.Dept") %></td>
	  <td><%# DataBinder.Eval(Container, "DataItem.App") %></td>
	</tr>
	<tr>
	  <td colspan="4">
		<span>
		  <asp:LinkButton ID="lnkbDetail" runat="server"
			CommandArgument='<%# DataBinder.Eval(Container, "DataItem.issue_id") %>'>+</asp:LinkButton> …
tgreer 189 Made Her Cry Team Colleague

I have no idea. Let me politely urge you to BECOME advanced enough. This isn't the "where can I download scripts" forum, it's the "how do I write scripts" forum. You'll get plenty of help, from me and others. Let's start by defining the tasks your script needs to accomplish:

  1. maintain a counter
  2. alter the contents of an element
  3. open a new window

There. The task seems more managable, now, doesn't it?

Let's write some HTML markup as a test harness. We just need some simple hyperlinks. When the user clicks a link, all we want to do is task #1, increment a counter.

First, the HTML:

<html>
<head>
</head>
<body>

<a href="#" id="link_01">Hyperlink 1</a><br />
<a href="#" id="link_02">Hyperlink 2</a><br />
<a href="#" id="link_03">Hyperlink 3</a>

</body>
</html>

Simple enough. We don't want these links to go anywhere... the script will eventually do that for us. So, we set the HREF property to a hash-mark, which is essentially the top of the page.

Now, let's implement a counter, by adding to our HTML:

<html>
<head>
<script type="text/javascript">

var counter = 0;
function link_click()
{
  counter++;
  alert(counter);

}

</script>
</head>
<body>

<a href="#" id="link_01" onclick="link_click();">Hyperlink 1</a><br />
<a href="#" id="link_02" onclick="link_click();">Hyperlink 2</a><br />
<a href="#" id="link_03" onclick="link_click();">Hyperlink 3</a>


</body>
</html>

When the user clicks a link, it runs the script. The script increments the counter and displays the current value of the counter via an alert.

Digest that, ask any questions you have, …

tgreer 189 Made Her Cry Team Colleague

Hi
The main point I need to clear up (in my head) is this: If a visitor to my site doesn't have Javacript - they can't see the effects that I've written but will see an invite to download it (?)

No. They'll simply get errors. The overwhelming majority of users have JavaScript enabled. In over a decade of programming on the web, I can probably count on my fingers the number of problems I've had with my sites due to users not having JavaScript.

It's nice to be aware of the problem, but I wouldn't let it worry you.

tgreer 189 Made Her Cry Team Colleague

Of course. Set the onclick attribute of these links to run a script. That script can increment a counter, alter the text within a control, open windows, etc.

tgreer 189 Made Her Cry Team Colleague

Experiments continue...

It's simple enough to create a SqlDataSource which selects all of the "master" records, and to bind that to a GridView. If one sets the "Enable Selection" to True, it adds a select command control to each row.

Then, add a second SqlDataSource, tied to a query or stored procedure that displays the detail. In the wizard, one can specify that a parameter comes from a control, in this case, our first GridView.

Create a second GridView, bound to the second SqlDataSource.

Now, when the user clicks "Select" in the parent GridView, the child GridView displays all the associated detail records.

All well and good. The issue is formatting. I don't want two separate GridViews. I want the second, child or "detail" GridView to display underneath the parent row. Each "detail" listing should be collapsible... it should be possible to display as many "detail" sections as the user wants.

Any suggestions on how to go about that?

tgreer 189 Made Her Cry Team Colleague

Has ASP.NET 2.0 introduced a simplified data control for displaying parent/child data?

Imagine a HelpDesk application, where you want to display all the "open tickets". I can see how you'd use a GridView for that.

However, each row in the resulting table should have the ability to, when clicked/selected show all the "details" for that ticket.

Make sense? Two separate queries, related by an identity field. I know how to do this with a DataGrid, and this is typically referred to as "Master/Detail" or "Parent/Child" data.

I'm just wondering if there is anything new in ASP.NET 2.0 that simplifies this.