Ahhh, ok... here you go.. this should work and be easy...
On the client-side, every time the volume is changed, you need to populate a
hidden field with the value.
On the server-side, create a hidden field:
private void Page_Load(object Sender, EventArgs e)
{
Page.RegisterHiddenField("hidVolume", "50") // just setting 50 for a
default value,
//it can be whatever you want.
int Volume = (Request.Forms["hidVolume"] != null ?
int.parse(Request.Forms["hidVolume"]) : 0);
}
<script language="JavaScript">
function SaveVolume(vol)
{
document.getElementByID("hidVolume").Value = vol;
}
</script>
Believe it or not, there are at least 2 or 3 other ways to do it..
Try this one also:
<script language="javascript">
function GetVolume()
{
var curVol = "<% = (string)Session["curVolume"] %>";
// OR //
var curVol = <% = (int)Session["curVolume"] %>;
document.getElementByID("Media").Volume = curVol;
}
And, on your server-side, you can do this...
private void Page_Load(object Sender, EventArgs e)
{
Page.RegisterHiddenField("hidVolume", "50") // just setting 50 for a
default value,
//it can be whatever you want.
Session["curVolume"] = (Request.Forms["hidVolume"] != null ?
int.parse(Request.Forms["hidVolume"]) : 0);
}
There are a few more ways to do it also...
Anyhow,
HTH,
Bill P.
Ok what is happening is I have an embedded control (Media) and an array of
buttons corresponding to first letters (A-Z). When the user clicks one of
the buttons a listbox is populated (postback) with file names. Clicking a
file name plays the file. This works fine.
Now to persist the volume over clicks is the specific problem but is most
likely a general problem (I am doing this to learn ASP.NET, I have 30 year
of experience from main-frame to VB3-6 / SQL Server etc.).
When one of the buttons is clicked I want to save the value to a field which
would be persisted. I am not trying to do it in client side code other than
using the javascript to extract the value. If I could find the control and
extract the value in the server code I would not have this problem. I have
no idea how to get the control into the server side code either. I have a
feeling this should be simple but so far not so.
when
the