Showing posts with label session. Show all posts
Showing posts with label session. Show all posts

Thursday, March 29, 2012

Pop Ups

Hi

I am using a popup, I launch the popup from a form, the user then choses an item on the popup, which is put into a session variable and then another form is launched. This works OK except the original form which launched the popup is still open how do I close it when the popup is launch. I use the code below to launch the popup

Dim sTempAsString

sTemp = "<script>window.open('LPopUpContractor.aspx',null,'top=150,left=250,height=150,width=450,status=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=no');</script>"

Response.Write(sTemp)

Response.Flush()

Thanks

Louisa

Hi,
you can close the form from its container window,
<!-- Put this script in MyMainForm.aspx -->
<script type="text/javascript">
window.open('myPopupForm.aspx');
window.close();
</script>

or let the popup close the window that launched it,
<!-- Put this script in myPopupForm.aspx -->
<script type="text/javascript">
if(window.opener) {
window.opener.close();
}
</script>

This works brillantly, but I now get a popup before mine saying:

The Web page you are viewing is trying to close the window

Do you want to close this window?

I click on the yes and my popup appears, how do I get rid of the error msg popup?

Thanks

Louisa


Hi,
it is not an error message popup, it is an Internet Explorer security setting that prevents a script to close a window that wasn't opened by the script itself, without the user permission... well, it seems that a workaround exists for Internet Explorer, just try to set the window.opener property to some value. For example
<script type="text/javascript">
window.opener = this;
window.open('myPopup.aspx');
window.close();
</script>

but I'm not sure it will work on all browsers.


Hi,

The above doesn't seem to work for me as it just puts the pages into a loop, can I not close a previous page from the page load of the new page, when the new page is fully loaded?

Thanks

Louisa


Hi,
I don't know if a workaround exists for the security popup. Try to post this question in theClient Side Web Develoment section of these forums.

a little discussion about that same pop-up

http://forums.asp.net/962609/ShowPost.aspx


Hi,
thanks for posting the link, onewisehobbit.

Saturday, March 24, 2012

Populate Session Variables from Datagrid for a specific cell

I need to know how to get a specific row/cell of data to post as a session variable - like I would with an ASP.Net table:

Dim ld_sum_tot_cty_tax As Doubl
Session("wa_tot_gal") = tbl_worksheet1.Rows(16).Cells(3).Text(

I am using VB.Net as the code behind, and populating the datagrid dynamically in a VB.Net Class Module - I am NOT connecting to an SQL database, but I do use the databind function

dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet
dtg_worksheet1.DataBind(

How can I do this programmatically with the datagrid? Any help is GREATLY appreciated! Coleen

--
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/Every row of data which is bound to the grid fires the itemdatabound event.
So in its handler, you can take the appropriate action. Consider
Session["row"] = e.item.cells[0].text will store the first colum of the row
being bou nd

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
<coleenholley> wrote in message
news:%23Nx9N6d6DHA.2568@.TK2MSFTNGP10.phx.gbl...
> I need to know how to get a specific row/cell of data to post as a session
variable - like I would with an ASP.Net table:
> Dim ld_sum_tot_cty_tax As Double
> Session("wa_tot_gal") = tbl_worksheet1.Rows(16).Cells(3).Text()
> I am using VB.Net as the code behind, and populating the datagrid
dynamically in a VB.Net Class Module - I am NOT connecting to an SQL
database, but I do use the databind function:
> dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet1
> dtg_worksheet1.DataBind()
> How can I do this programmatically with the datagrid? Any help is GREATLY
appreciated! Coleen
> --
> Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest
Community Website: http://www.dotnetjunkies.com/newsgroups/
Thanks - that helps, but I need to get the value from a Specific row - the data returned will ALWAYS have 17 rows - it will return one row for each County in Nevada, and there are 17 Counties. I specifically need to get the value from row (county) 16 for a session variable. Using Session["row"] = e.item.cells[7].text will store the seventh colum of the which row? How do I tell it to specifically get row 16? I REALLY need to have the functionality of Row(16).Cell(7); it is imperitive to the application we are building...any suggestions on getting the exact row number? Thanks for your help. Coleen

--
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
off the top of my head, if i didn't have the dataset already cached, i'd
collect each row and stack it into an array list. Then push that array list
into session.

Remind me again why you need to have this in a session variable (i've lost
the original thread)? It would seem to me that if you cache the entire
dataset, or datatable, then you could easily retrieve the dataset and access
the value directly. Consider:

DataSet ds = Session["Data"] as DataSet;
if(ds != null && ds.Tables[0].Rows.Count > 16)
value = ds.Tables[0].Rows[16][7].ToString();

Ofcourse, it is more memory efficient to cache a datatable or to stack just
the rows in an arraylist.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
<coleenholley> wrote in message
news:uP4atYn6DHA.1040@.TK2MSFTNGP10.phx.gbl...
> Thanks - that helps, but I need to get the value from a Specific row - the
data returned will ALWAYS have 17 rows - it will return one row for each
County in Nevada, and there are 17 Counties. I specifically need to get the
value from row (county) 16 for a session variable. Using Session["row"] =
e.item.cells[7].text will store the seventh colum of the which row? How do
I tell it to specifically get row 16? I REALLY need to have the
functionality of Row(16).Cell(7); it is imperitive to the application we are
building...any suggestions on getting the exact row number? Thanks for your
help. Coleen
> --
> Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest
Community Website: http://www.dotnetjunkies.com/newsgroups/