Thursday, March 29, 2012

Pop Up Window Name - Would like it to be timestamp

Hi,

I'm an asp programmer currently in the low process of converting one of my asp intranets into asp.net (vb).

This is going to be one of many questions i ask on the forum (glad I've found it) !

I have a link a page that opens up popup window (removes all the buttons from the nav bar, chromless effect).

I would normally do the following at the top of the page:

<script language=javascript runat=server>
function GetTimeInMillisec()
{
var Now = new Date()
var TimeStamp = Now.getTime()

return TimeStamp
}
</script>
<%
varTimeStamp = GetTimeInMillisec()
%
Then the link would be:

<a href="http://links.10026.com/?link=javascript:launchwin('frameset.asp','<%=varTimeStamp%>','width='+(screen.width-11)+',height='+(screen.height-92)+',screenX=0,screenY=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,status=1,toolbar=0,top=0,left=0,resizable=yes')">Open</a
Can someone give me some pointers on how I am able pass a timestamp value (or another random character string) into the name of the window.

The reason I want this is in case a user wants to be able to have multiple instances of the system open.

Thank you
James Campbell

I take it you have a js function called launchwin? If so can you not set it there? If you want to use a .net datetime when the page was created use <%=DateTime.Now%>

There's few options depending on what your requirements are..


Hi,

Yes I have a js function called launchwin. Reading your post just makes me think that I am thinking too hard about a very simple problem !

Thanks for the nudge in the right direction.

James


To complete this thread I now have:

<a href="http://links.10026.com/?link=javascript:launchwin('System/Login.aspx','<%=DateTime.Now.toString("mmssffffff")%>','width='+(screen.width-11)+',height='+(screen.height-92)+',screenX=0,screenY=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,status=1,toolbar=0,top=0,left=0,resizable=yes')">Launch</a
Thanks jibber !

James

Pop Up Window with Server.Transfer

Hi,

In one of my asp.net page, when users click on a button, I am using Server.Transfer to redirect user to another page and pass all the info to that page asServer.Transfer("TripDetails.aspx").

I need to open a new window and pass all the info to new page. How can I achive this? How can I open a new window and useServer.Transfer at the same time?

Thanks

On the click event of the button you'll need to open a new window there using javascript like window.open. If the button is submitting a form you can set the TARGET of the FORM to be _blank;

<FORM target="_blank" action="...">


Thanks Aidy, it works for me.

pop up window using javascript

hi how can I open this link in new pop up window using javascript?
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.g
if">Amex?</asp:HyperLink>
mahsamahsa,
Try set Target=_blank
Thomas Andersson
"mahsa" wrote:

> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex
.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in
<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A>
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.
Dale Preston
MCAD, MCSE, MCDBA
"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
>
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>

pop up window using javascript

hi how can I open this link in new pop up window using javascript?
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink
--
mahsamahsa,

Try set Target=_blank

Thomas Andersson

"mahsa" wrote:

> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in

<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.

Dale Preston
MCAD, MCSE, MCDBA

"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
> > hi how can I open this link in new pop up window using javascript?
> > <asp:HyperLink id="HLink_Amex" runat="server"
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> > --
> > mahsa

Pop Up windows

Hello,
What is the best approach to bringing up pop-up windows to verify a users
request. (i.e. - "Are you sure you want to delete? yes no)
I know how to bring the window up in javascript...but once the user click
"yes" in the new pop-up window, I need to somehow invoke a delete call in
the c# code behind of the original page.
Any help would be appreciated.
Thanks.Using either a Button or LinkButton control, you can add the "onclick"
attribute to it and place the javascript code in there.
For example:
lnkCancel.Attributes.Add("onclick", "return window.confirm('Are you sure
you want to cancel this order?');");
If the user clicks OK, the button will submit and the appropriate
code-behind for the button will be executed. If the user clicks cancel,
then the form will not submit.
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Bilbo" <Bilbo@.cox.net> wrote in message
news:OcSpUe6iEHA.3876@.TK2MSFTNGP15.phx.gbl...
> Hello,
> What is the best approach to bringing up pop-up windows to verify a users
> request. (i.e. - "Are you sure you want to delete? yes no)
> I know how to bring the window up in javascript...but once the user click
> "yes" in the new pop-up window, I need to somehow invoke a delete call in
> the c# code behind of the original page.
> Any help would be appreciated.
> Thanks.
>

Pop Up windows

Hello,

What is the best approach to bringing up pop-up windows to verify a users
request. (i.e. - "Are you sure you want to delete? yes no)

I know how to bring the window up in javascript...but once the user click
"yes" in the new pop-up window, I need to somehow invoke a delete call in
the c# code behind of the original page.

Any help would be appreciated.

Thanks.Using either a Button or LinkButton control, you can add the "onclick"
attribute to it and place the javascript code in there.

For example:

lnkCancel.Attributes.Add("onclick", "return window.confirm('Are you sure
you want to cancel this order?');");

If the user clicks OK, the button will submit and the appropriate
code-behind for the button will be executed. If the user clicks cancel,
then the form will not submit.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"Bilbo" <Bilbo@.cox.net> wrote in message
news:OcSpUe6iEHA.3876@.TK2MSFTNGP15.phx.gbl...
> Hello,
> What is the best approach to bringing up pop-up windows to verify a users
> request. (i.e. - "Are you sure you want to delete? yes no)
> I know how to bring the window up in javascript...but once the user click
> "yes" in the new pop-up window, I need to somehow invoke a delete call in
> the c# code behind of the original page.
> Any help would be appreciated.
> Thanks.

Pop up windows

Hi,

How to make pop up window from code behine without using
java script. And another thing is that, how to pass value
from the pop up window to a form if there is a textbox in
the pop up. ThanksMaking popup windows is a client task and as such it can be done only with
client tools. The only way to create a popup is javascript showModalDialog
call.

You can pass a value back from popup in window.returnValue property. The
javascript showModalDialog statement that started the popup will get this
value as a result of the call.

Eliyahu

"Souljaz" <Souljaz@.discussions.microsoft.com> wrote in message
news:1ddd01c52de9$9e89fb80$a401280a@.phx.gbl...
> Hi,
> How to make pop up window from code behine without using
> java script. And another thing is that, how to pass value
> from the pop up window to a form if there is a textbox in
> the pop up. Thanks

Pop Up Window..ASP.NET

Hi,
I have a webform with a button.
When the user moves their mouse over the button.. I would
like to initiate a mouseover event that shows a small
window with text.. The text will be populated from a
dataset...
Does anyone here know how to do this?
I have code that does the mouseover in javascript.. A
window even pops up.. but I am not sure how to send
dynamic text to this window...
I hope I am being clear enough..
A tooltip would be ok if I could get the data to show up
in 2 lines neatly.. ie
DATAROW 1
DATAROW 2
Any ideas?
ThanksThere are a couple of possibilities.
1. Dynamically create the Window.Open() URL to include enough information to
pull from a database.
2. Feed the data into JavaScript when the page is initially called and
create a tooltip. If you cannot easily do it with HTML, consider setting up
a
layer and painting it on the mouseover event.
NOTE: The second option is more difficult to implement, as different
browsers render layers differently (some older browsers will not render at
all), so the option is more applicable to a controlled environment, like an
Intranet.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"seep" wrote:

> Hi,
> I have a webform with a button.
> When the user moves their mouse over the button.. I would
> like to initiate a mouseover event that shows a small
> window with text.. The text will be populated from a
> dataset...
> Does anyone here know how to do this?
> I have code that does the mouseover in javascript.. A
> window even pops up.. but I am not sure how to send
> dynamic text to this window...
> I hope I am being clear enough..
> A tooltip would be ok if I could get the data to show up
> in 2 lines neatly.. ie
> DATAROW 1
> DATAROW 2
> Any ideas?
> Thanks
>
Check out this article,
http://www.microsoft.com/india/msdn...endarinASP.aspx
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"seep" <seep@.hotmail.com> wrote in message
news:140501c4e775$ae32c810$a301280a@.phx.gbl...
> Hi,
> I have a webform with a button.
> When the user moves their mouse over the button.. I would
> like to initiate a mouseover event that shows a small
> window with text.. The text will be populated from a
> dataset...
> Does anyone here know how to do this?
> I have code that does the mouseover in javascript.. A
> window even pops up.. but I am not sure how to send
> dynamic text to this window...
> I hope I am being clear enough..
> A tooltip would be ok if I could get the data to show up
> in 2 lines neatly.. ie
> DATAROW 1
> DATAROW 2
> Any ideas?
> Thanks
>

Pop Up Window..ASP.NET

Hi,
I have a webform with a button.
When the user moves their mouse over the button.. I would
like to initiate a mouseover event that shows a small
window with text.. The text will be populated from a
dataset...

Does anyone here know how to do this?
I have code that does the mouseover in javascript.. A
window even pops up.. but I am not sure how to send
dynamic text to this window...

I hope I am being clear enough..
A tooltip would be ok if I could get the data to show up
in 2 lines neatly.. ie

DATAROW 1
DATAROW 2

Any ideas?

ThanksThere are a couple of possibilities.

1. Dynamically create the Window.Open() URL to include enough information to
pull from a database.

2. Feed the data into JavaScript when the page is initially called and
create a tooltip. If you cannot easily do it with HTML, consider setting up a
layer and painting it on the mouseover event.

NOTE: The second option is more difficult to implement, as different
browsers render layers differently (some older browsers will not render at
all), so the option is more applicable to a controlled environment, like an
Intranet.

--

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"seep" wrote:

> Hi,
> I have a webform with a button.
> When the user moves their mouse over the button.. I would
> like to initiate a mouseover event that shows a small
> window with text.. The text will be populated from a
> dataset...
> Does anyone here know how to do this?
> I have code that does the mouseover in javascript.. A
> window even pops up.. but I am not sure how to send
> dynamic text to this window...
> I hope I am being clear enough..
> A tooltip would be ok if I could get the data to show up
> in 2 lines neatly.. ie
> DATAROW 1
> DATAROW 2
> Any ideas?
> Thanks
>
Check out this article,
http://www.microsoft.com/india/msdn...endarinASP.aspx

--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"seep" <seep@.hotmail.com> wrote in message
news:140501c4e775$ae32c810$a301280a@.phx.gbl...
> Hi,
> I have a webform with a button.
> When the user moves their mouse over the button.. I would
> like to initiate a mouseover event that shows a small
> window with text.. The text will be populated from a
> dataset...
> Does anyone here know how to do this?
> I have code that does the mouseover in javascript.. A
> window even pops up.. but I am not sure how to send
> dynamic text to this window...
> I hope I am being clear enough..
> A tooltip would be ok if I could get the data to show up
> in 2 lines neatly.. ie
> DATAROW 1
> DATAROW 2
> Any ideas?
> Thanks

pop up windows and triggering an event after closed

Hello everyone -

I have a javascript onclick event that pops up a window,
allows the user to view information, and then close the window.

Now - I would like to be notified when this window is closed
in the asp.net page that pops it up.

Or - better yet - is there a way to popup the window in a modal mode
where the user must close the window prior to returning to the main web
application (and if at all possible - trigger an event when they are done)?

here is my current javascript for the poup window...

function upload_window()
{
var left = (screen.availWidth/2) - (600/2);
var top = (screen.availHeight/2) - (225/2);
var colorWin = window.open('upload_maps.aspx', "test", 'scrollbars=0, toolbar=0, statusbar=0, width=600, height=225, left='+left+', top='+top);
document.edit_maps_form.submit();
}

thanks for your help!!

take care
tonyThere's no way to do it server-side, but you COULD add JavaScript to do something to the window's opener when the popup window closes, i.e. window.opener.....
2) To show a modal window, use: window.showModalDialog('somepage.aspx','winName','dialogHeight:200px;dialogWidth:200px; etc..');
Remember, this only works with IE.

1) To notify the aspx page when the new window is closed, you can write Javascript:
window.opener.document.FormNameFromASPXPage.someTextBox.Text = "new win is closed";

Pop up windows

Hi,
How to make pop up window from code behine without using
java script. And another thing is that, how to pass value
from the pop up window to a form if there is a textbox in
the pop up. ThanksMaking popup windows is a client task and as such it can be done only with
client tools. The only way to create a popup is javascript showModalDialog
call.
You can pass a value back from popup in window.returnValue property. The
javascript showModalDialog statement that started the popup will get this
value as a result of the call.
Eliyahu
"Souljaz" <Souljaz@.discussions.microsoft.com> wrote in message
news:1ddd01c52de9$9e89fb80$a401280a@.phx.gbl...
> Hi,
> How to make pop up window from code behine without using
> java script. And another thing is that, how to pass value
> from the pop up window to a form if there is a textbox in
> the pop up. Thanks

pop up windows

Hi!

I have programmed in Java and Windows form but very new to ASP and web in general. It is very primitive question but currently, I do not know. I want a small pop up windows with close or the like button that will appear when I click on a button. In Java or NET, you can use show method but in ASP or Webmatrix in particular, what component should I use .

Regards.Hello, check my BLOG, I have an article on how to pop up a window from inside ASP.NET

regards
I'm sure haidar's blog shows the proper method - but to help clear up for future knowledge..
Popping up a web page is a client-side event. The .Net server can't feed a popup to your browser- think of all the uncontrollable popups that would occur if the server-side could do this. opening a popup is a clients-ide event using javascript (window.open method)
Hope that helps - and it's a common question - understanding what events are client-side and what are server-side will help avoid confusion
Of course the contents of the popup can be totally designed (perhaps as a web user control) on the server side from within .NET and then merely instanciated in the javascipt. This gives full access to all of the .NET design environment features for the pop-up.

ps: I have not read the blog entry, so that *may* how it is done there also...
Hi!

I use Javascript but as very primitive programmer, I just am able to have this code:

<a onclick="window.open('materialchecking.aspx textbox=txtStartDate','cal','width=250,height=225,left=270,top=180')" href="http://links.10026.com/?link=javascript:;">
<input type="button" value="Check" /></a
It works fine as static page. However, what if I want to transfer some variable value from main page to the pop up windows to do the checking or other way around, do ing some data processing when button is clicked and transfer the result in to the pop up. I guess, there should be other approach as the href is perhaps too simple to do that.

Regards.
Hello, please check my BLOG below, I have an article on how to pop up windows inside asp.net

regards
Sorry!

I did not go to Pop up before and just went to your personal website and could not see the article (!1).

OK. But now question is that I want to transfer some data between master page and pop up windows. How is it possible. Suppose pop up windows is to show the number of stock in record and in store is not different. So when button is clicked, I have top go to server-side database to do something and finally transfer thw TWO number to the pop up. So how to do that.

Thank you so much for your attention.
ok, you might use the Querystring to pass values to the child window

regards
Hi!

I would really appreaciate if you can show me a bit of code to pass A VALUE to child windows.

Regards.
using function in blog...


*************************************
Javascript pop up window script
*************************************
<SCRIPT TYPE="text/javascript">
<!--
function popupform(myform, url, windowname)
{
// don't allow if we don't have the focus
if (! window.focus)return true;

// open the new window,
window.open(url, windowname, 'width=250,height=225,left=270,top=180,scrollbars=yes');
myform.target=windowname;
return true;
}
//-->
</SCRIPT>

then in your link...


<a onclick="popupform(this,'materialchecking.aspx?id='+ document.getElementById('textbox1').value,'cal')" href="http://links.10026.com/?link=javascript:"><input type="button" value="Check" /></a>
</body>
<input type="button" value="Check" /></a>

one of many ways probably .......

HTH
Hi!

Please forgive me if I apprea to be a bit dump. I am quite new to the field. As far as I understand, the call: document.getElementById is to set the value of textbox 1 to cal var. So in the pop up page, which command I should use to EXTRACT that value for use.
In MSDN page, i says that we can pass a colection of value. That is fine, Juts search var by id inb Collection. But I mean what command to EXTRACT those value in the page after we pass that value in the open up command.

To help make it clear, suppose I have an page asking for the invoice number. As within an invoice, there can be many materials with different quantity and price so I decide that after use enter the Supplier and Invoice number, user will be presented with Pop up windows that has text box and dropdownlist to enter list of data. But in this Pop up windows , the Supplier name and invoice name shold be present. I am looking for way to show the Suplier name and Invoice number on the Pop up windows.

Thank you very much for your attention.
in the example - the id of the invoice is being passed using "querystring"
if you look up at the address of this forum page- you will see "?tabindex=1&PostID=782635&mode=flat"
or something like that - this is called the querystring. It is passed as part of the url the client is requesting. In this example there are 3 things being passed - tabindex,postid, and mode
On the page being called- you can access theses values by using

dim myPostID as string
dim myTabIndex as string
dim myMode as string

myPostID = request.querystring("tabindex")
myTabIndex = request.querystring("PostID")
myMode = request.querystring("mode")

then i can use this any way i need to such as..
Sub Page_Load()
dim mySQL as string="Select * from posts WHERE PostId=" & MyPostID
....................

not exact code - but you get the idea

if on the first page, you already hace the supplier and invoice number - then you can pass that in the querystring as such

a onclick="popupform(this,'materialchecking.aspx?Supplier='+ document.getElementById('textbox1').value+ "&Invoice=" + document.getElementById('textbox2').value,'mypopupwindow_name')"

on the recieving page materialchecking.aspx - you would use

Sub Page_Load()
dim MySupplier as string = request.querystrin("Supplier")
dim MyInvoice as string = request.querystrin("Invoice")

HTH
Thank you uncleb1

They all work now. Apart from "&Invoice=" I have to change to '&Invoice' (!!!!cheer), all work and I learn a lot from this doing. Thank you
Hi again!

Now there is more challenge. Suppose I have an textbox that must be filled. I use RequiredValidator. Problem is that with "normal" button, I can write the code for validator but I do not know how for the ´button, created with javascript. Basically, the Pop up windows only works if textbox is not empty.
if you used this function


<SCRIPT TYPE="text/javascript">
<!--
function popupform(myform, url, windowname)
{
// don't allow if we don't have the focus

if (! window.focus)return true;
// open the new window,
window.open(url, windowname, 'width=250,height=225,left=270,top=180,scrollbars=yes');
myform.target=windowname;
return true;
}
//-->
</script>
......... you have a place to check for null

<SCRIPT TYPE="text/javascript">
<!--
function popupform(myform, url, windowname)
{

// don't allow if textbox is blank
if documet.getElementById(textbox1).value="" return true;

// don't allow if we don't have the focus
if (! window.focus)return true;
// open the new window,
window.open(url, windowname, 'width=250,height=225,left=270,top=180,scrollbars=yes');
myform.target=windowname;
return true;
}
//-->
</script>

or you could use a serverside asp textbox and use the built in asp validation - check out this tutorial
http://www.dotnetjunkies.com/QuickStart/aspplus/default.aspx?url=/quickstart/aspplus/doc/webvalidation.aspx

HTH

Pop Up without TitleBars?

Hello All!
I have been trying to customize pop up windows for my ASP.NET Page. I want
to have a custom title bar. Is there a way to remove the windows title bar
from the pop up and make it apear as a frameless window?
Also I am using Windows XP with SP1.
If you know a way out, please help me!
Regards
Jyoti> Hello All!
> I have been trying to customize pop up windows for my ASP.NET Page. I want
to
> have a custom title bar. Is there a way to remove the windows title bar fr
om
> the pop up and make it apear as a frameless window?
> Also I am using Windows XP with SP1.
> If you know a way out, please help me!
> Regards
> Jyoti
I don't think that is possible, mainly for security reasons.
The fact that *you* are using a particular platform is not important
here, you will need to know what your *visitors* are using.
Hans Kesting
Thanks for replying Hans!
The point is that my application should work for the visitors using Windows
XP! And its not working there! Well, I am still trying to find a way out.
Thanks for your help!
Regards Jyoti
"Hans Kesting" <news.1.hansdk@.spamgourmet.com> wrote in message
news:mn.724c7d5b866fd633.41829@.spamgourmet.com...
> I don't think that is possible, mainly for security reasons.
> The fact that *you* are using a particular platform is not important here,
> you will need to know what your *visitors* are using.
> Hans Kesting
>

Pop Up without TitleBars?

Hello All!

I have been trying to customize pop up windows for my ASP.NET Page. I want
to have a custom title bar. Is there a way to remove the windows title bar
from the pop up and make it apear as a frameless window?

Also I am using Windows XP with SP1.
If you know a way out, please help me!

Regards
Jyoti> Hello All!
> I have been trying to customize pop up windows for my ASP.NET Page. I want to
> have a custom title bar. Is there a way to remove the windows title bar from
> the pop up and make it apear as a frameless window?
> Also I am using Windows XP with SP1.
> If you know a way out, please help me!
> Regards
> Jyoti

I don't think that is possible, mainly for security reasons.

The fact that *you* are using a particular platform is not important
here, you will need to know what your *visitors* are using.

Hans Kesting
Thanks for replying Hans!

The point is that my application should work for the visitors using Windows
XP! And its not working there! Well, I am still trying to find a way out.
Thanks for your help!

Regards Jyoti

"Hans Kesting" <news.1.hansdk@.spamgourmet.com> wrote in message
news:mn.724c7d5b866fd633.41829@.spamgourmet.com...
>> Hello All!
>>
>> I have been trying to customize pop up windows for my ASP.NET Page. I
>> want to have a custom title bar. Is there a way to remove the windows
>> title bar from the pop up and make it apear as a frameless window?
>>
>> Also I am using Windows XP with SP1.
>> If you know a way out, please help me!
>>
>> Regards
>> Jyoti
> I don't think that is possible, mainly for security reasons.
> The fact that *you* are using a particular platform is not important here,
> you will need to know what your *visitors* are using.
> Hans Kesting

Pop up with AJAX enable page

help pls. I just add the Ajax tools on my page and now my pop up code is not working.
Page.ClientScript.RegisterStartupScript(Me.GetType, "myscript", "<script Language='JavaScript'>alert('" + x + "');</script>")
tnxPage.Clientscript.RegisterStartupScript(me,"scriptAlert","alert('test');",True);

Look at the last parameter.
Page.Clientscript.RegisterStartupScript(me,"scriptAlert","alert('test');",True)

error on "me" - cannot be converted to 'system.type'

any other solution pls... tnx
Sorry, my bad.

Page.ClientScript.RegisterStartupScript(Me.GetType, "scriptAlert", "alert('test');", True)
Sorry, my bad.

Page.ClientScript.RegisterStartupScript(Me.GetType, "scriptAlert", "alert('test');", True)

:D it's me again. ive tried your code but still no pop up message :(. this code works if you dont have Ajax updatepanel but in my case i used AJAX Updatepanel. any help pls.

tnx
Does this help?

http://www.asp.net/AJAX/Documentation/Live/tutorials/CustomizingErrorHandlingforUpdatePanel.aspx
Does this help?

http://www.asp.net/AJAX/Documentation/Live/tutorials/CustomizingErrorHandlingforUpdatePanel.aspx

yes it helpz. tnx to all

pop up windows with img and text from...?

using vb.net, with sql 2000 personal edition.

I'm trying to create a portfolio page, the pages would be divided into years from 2001 ~ 2004 with each page a link of projects that my company has done. when the link is clicked it would open a new window with both image and text.

my question is how should i build this pop up page, with over 90 images i do not want to create individual aspx pop up windows, so if i was to get img and text info where should it be coming from? would sql server or is there was a to put this info in the project page? I haven't a clue, plz help.

ps. if you can point me to an example on the net that would be great..

focusA good place to start may be the following tutorial:
A Robust Image Gallery for ASP.NET
wow thanks NewKid2~

i'm still reading it but its a great example, not only for my project but for my personal use as well, also i love the fact that its in vb.net there should be a page called top 10 everyday examples in vb.net for the noobie in you!

focus
> there should be a page called top 10 everyday examples in vb.net

Well, the same guys have written a bunch of ASP.NET articles, most of them using VB.NET, and all written in an easy-to-understand way.

You can see the entire list of their articles here:
http://aspnet.4guysfromrolla.com

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.

pop ups

Is there any way to programmatically open pop ups with SP2? My ASP.NET site
uses JavaScript to open new browser windows and they are being shut down
automatically...Pop up blockers don't block windows that are opened by the same domain as
the page that is loaded.

"mareal" <m@.m.com> wrote in message
news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> Is there any way to programmatically open pop ups with SP2? My ASP.NET
> site
> uses JavaScript to open new browser windows and they are being shut down
> automatically...
Thank you Scott. I am not sure I am following. My browser even blocks
Microsoft pop ups from this forum unless I allow them.

I was hoping to find some kind of command to allow my site to open new
browser windows (overwriting pop ups directives)

"Scott M." wrote:

> Pop up blockers don't block windows that are opened by the same domain as
> the page that is loaded.
> "mareal" <m@.m.com> wrote in message
> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> > Is there any way to programmatically open pop ups with SP2? My ASP.NET
> > site
> > uses JavaScript to open new browser windows and they are being shut down
> > automatically...
>
The pop ups you get from various web sites (including MS) don't actually
have content that comes from the domain you are visiting. Most companies
have special servers dedicated to just serving up the advertising content
(ad servers). For example, the content of a popup ad that you got while
visiting cnn.com might actually be coming from http://ads.cnn.com and the
content of the popup windows you get while visiting Microsoft's web site
might actually be coming from http://ads.microsoft.com.

When you build a web page that includes the window.open() client-side
scripting command that doesn't mean that a popup blocker will prevent that
window from opening. Most popup blockers look to see where the content of
that new window is coming from. If it is from the same domain as the page
that launched it, the popup will be allowed, if not it won't.

For example, visit this page that I built and run for my son's cub scout
pack (http://pack96.org/Calendar/PackCalendar.aspx) and click on one of the
links. You will see that the popup windows do not get blocked even though
your popup blocker is on.

-Scott

"mareal" <m@.m.com> wrote in message
news:DD978129-4376-435E-8F35-C4F80209AD1F@.microsoft.com...
> Thank you Scott. I am not sure I am following. My browser even blocks
> Microsoft pop ups from this forum unless I allow them.
> I was hoping to find some kind of command to allow my site to open new
> browser windows (overwriting pop ups directives)
> "Scott M." wrote:
>> Pop up blockers don't block windows that are opened by the same domain as
>> the page that is loaded.
>>
>> "mareal" <m@.m.com> wrote in message
>> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
>> > Is there any way to programmatically open pop ups with SP2? My ASP.NET
>> > site
>> > uses JavaScript to open new browser windows and they are being shut
>> > down
>> > automatically...
>>
>>
>

Pop Up?

I set the ValidationSummary control's ShowMessageBox property to display
error message in a dialog box.
But I found it only works with IE, Not Netscape.

Did someone have it work ever?

Thanks.Hi,

Validations got server and client side validation. When you browse your
pages in Netscape they use the server-side validation and not the
client-side validation as the client side Validation scripts only works
only with IE.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Pop Up/Refresh Issue

I have a parent page that contains a datagrid. On this page is a link to "Add New" record. I have done this by opening a child/pop up so they can enter the data in a new window. When the user submits, the parent page reloads and refreshes the data. Here is the code in the child page:

btnAdd.Attributes.Add("onclick", "window.opener.location.reload();");

I kinda have two problems here, one I can live with...for now.

Problem 1: When the page reloads, the user has to click "Retry". This works, but is a bit sloppy. I've searched a few different methods on this forum, but none seem to submit and refresh my data. (I can't simply refresh because I have a few panels on the parent that throw a wrench into it)

Problem 2: The line that I posted earlier is fine, and works well; however I do have some validation (server side) on the child form. If the validation in the btnAdd_Click event isn't a success, I would like to avoid reloading the parent. How would I go about doing that?

Thanks.

Just to clarify a bit, I want to check a condition before I have my js reload the parent page.

Let's say:

If (someCondition)

{

//reload parent page

}

else

{

// don't reload parent page

}

Any suggestions?


Instead of spamming the forum with much of the same problem, I'll add to this one.

I would also like to somehow clear the last submmited button on the parent from the child. Let me try to explain.

On the parent the user may press a button which kicks off validation on the server. If validation on the server fails, a message on the page is displayed. (Parent) Now, if the user decides to add a record at this time via the pop up or child, hitting update on the child will reload the parent page; however, in this case my grid on the parent won't refresh because it's executing the submit on the parent. Therefore displaying "validation failed", when in fact it didn't.

Eh, I know this probably sounds messy, but if someone can help with this or any of my other pop up/refresh problems in this thread, I would appreciate it.


I don't know of this is going to help you or not but here is my 2cents. On the child pop up page when the user submits the informationyou can send a value of true to the parent which will represent thatthe child form has been submitted. This value can be send usingQueryString or Session State. When the parent page recieves thisinformation it can referesh it.
Does that help ?

pop ups not working

Hi

i am working on a project which involves pop up windows to enter information which worked fine at uni

i brought the exact same project home and the popups dont 'popup, nothing happens

i've allowed popups in internet explorer, but they still dont work

is there something else i've overlooked??

cheers!!

hehe

sorry for wasting space

just remembered i took a line of code out just before i left uni yesterday that stopped popups working

blah!!

pop ups

Is there any way to programmatically open pop ups with SP2? My ASP.NET site
uses JavaScript to open new browser windows and they are being shut down
automatically...Pop up blockers don't block windows that are opened by the same domain as
the page that is loaded.
"mareal" <m@.m.com> wrote in message
news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> Is there any way to programmatically open pop ups with SP2? My ASP.NET
> site
> uses JavaScript to open new browser windows and they are being shut down
> automatically...
Thank you Scott. I am not sure I am following. My browser even blocks
Microsoft pop ups from this forum unless I allow them.
I was hoping to find some kind of command to allow my site to open new
browser windows (overwriting pop ups directives)
"Scott M." wrote:

> Pop up blockers don't block windows that are opened by the same domain as
> the page that is loaded.
> "mareal" <m@.m.com> wrote in message
> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
>
>
The pop ups you get from various web sites (including MS) don't actually
have content that comes from the domain you are visiting. Most companies
have special servers dedicated to just serving up the advertising content
(ad servers). For example, the content of a popup ad that you got while
visiting cnn.com might actually be coming from http://ads.cnn.com and the
content of the popup windows you get while visiting Microsoft's web site
might actually be coming from http://ads.microsoft.com.
When you build a web page that includes the window.open() client-side
scripting command that doesn't mean that a popup blocker will prevent that
window from opening. Most popup blockers look to see where the content of
that new window is coming from. If it is from the same domain as the page
that launched it, the popup will be allowed, if not it won't.
For example, visit this page that I built and run for my son's cub scout
pack (http://pack96.org/Calendar/PackCalendar.aspx) and click on one of the
links. You will see that the popup windows do not get blocked even though
your popup blocker is on.
-Scott
"mareal" <m@.m.com> wrote in message
news:DD978129-4376-435E-8F35-C4F80209AD1F@.microsoft.com...
> Thank you Scott. I am not sure I am following. My browser even blocks
> Microsoft pop ups from this forum unless I allow them.
> I was hoping to find some kind of command to allow my site to open new
> browser windows (overwriting pop ups directives)
> "Scott M." wrote:
>

POP3 and ASP.NET

I have searched for information on accessing POP3 accounts from ASP.NET. There are a couple of mentions in the forums, advising that there are many POP3 .NET components available for free, but I can only find one free component - CSLMail (http://www.wintoolzone.com/) which was last updated April 2003.

Unfortunately the documentation for CSLMail is very limited and the two very basic examples are in C# which has me stumped because I only know VB and am very new to VB.NET (although an old hand at ASP), so I'm having trouble translating them to a VB.NET web form.

I have also read a couple of POP3 articles at www.aspalliance.com, but I'm not ready to code my own components yet and again have trouble relating the code to a web form - I just need to access a POP3 account from a simple ASP.NET web page.

Can anyone suggest additional free POP3 components, or advise of some additional articles that I could read?

Thanks in advance.Soft-Artisans has a free PoP3 component that I had used before. I dont remember if there was vb.net documentation, or how good it was but its worth a shot for you.
Thanks for your reply. My searches had already taken me to Software Artisans' web site, but unfortunately, they have withdrawn the component!

Additional suggestions are welcome.

Thanks again.
Hi amigo how is life
You have mentioned an organization but not its url can i have its url plz.
softartisans.com
Thanks Boss.

pop3 access help

Hello,

Does ASP.NET support pop3 access. I would like to read a pop3 account. If not does anyone know of any good free pop3 asp.net components. I am using asp.net vb if this makes any difference

Thanks

Granthttp://www.google.be/search?q=cache:uhM2afinXZAJ:www.codeproject.com/useritems/POP3Library.asp+C%23+pop3+codeproject&hl=nl&ie=UTF-8

http://www.google.be/search?q=cache:01fZDLtY80QJ:www.codeproject.com/csharp/pop3client.asp+C%23+pop3+codeproject&hl=nl&ie=UTF-8

google is your friend :)

POP3

hi all,
i want to learn how i can use pop3?could you help,pls?
is there any article ,tutorial or any site to learn it
thanks in advanceHello ASP.N3T,
> hi all,
> i want to learn how i can use pop3?could you help,pls?
> is there any article ,tutorial or any site to learn it
> thanks in advance

You can use POP3 to retrieve email from a server over the network. See: http://en.wikipedia.org/wiki/POP3
thanks but i want a code sample to use POP3.
it was useful to know what POP3 is.but i need a sample to use it with vb.net
do you know any site?
again thanks
Aaah, source code. If you Google around for VB.NET POP3 you'll find some projects with source code. Here is one:http://www.codeproject.com/vb/net/QMailClient.asp

hi bitmask,
thanks alot for the reply...it was what i wanted
again many thanks

POP3

How can we use .NET Framework to get e-Mail from POP3?Try this tutorial:-

http://www.developerfusion.com/show/4071/

pop3

please help me with the complete code of

1. connecting to the pop3 server

2. authenticating the users

3. reading the mails of the logged in user

4. retrieving the mails to ur local system

5. closing the connection succesfully

i need the code in asp.net

pls reply as soon as possible

thank you

Hi,

start by beginning to take a look here:Frequently Asked Questions for System.Web.Mail

Grz, Kris.

POP3 component

I need to build a component using C#.NET that will look for emails with attachments. It needs to automatically download the attachment to a certain directory.
I don't even know where to start.
Please help.This article might get your started.

http://www.developerfusion.com/show/4071/
Thank you very much

pop3 connectivity

how to implement pop3 connectivity, with code

Why are you asking that in this forum?

What language, what application etc, etc,. In other words, be more specific, and ask your question in the right forum ...

(sorry if i seem to come down a bit hard on you, i know how difficult it is to ask the right question in the right place, so please eleborate on your question so that others can help you ...)

cheers,

erik


You can tryhttp://sourceforge.net/projects/hpop it's quite complete for a beta

ErikVB wrote:

Why are you asking that in this forum?


Moved to a better forum.

POP3 Email Account Polling

I am looking for a way to automatically poll a pop3 email account in asp.net. Basically I need to check the inbox every 15 seconds and on new e-mail get the from and body. Then I can do work with it like call a Microsoft SQL stored proc.

there are several pop3 clients available you can use to do this.

http://www.codeproject.com/KB/IP/despop3client.aspx

POP3 Mail Retrival- Does any one has source code?

Hi,
I am wondering if anyone has the source code (in C# or VB.net) to retrive
pop emails from the server. Please DO NOT suggest with somesort of component
solution because I can not trust the dlls (sorry for being rude!)
Thanks in advance. Your help is appreciated.
ProdipIs there any source code here that suits your needs?
http://www.gotdotnet.com/community/...aspx?query=pop3
"Prodip Saha" <psaha@.bear.com> wrote in message
news:ObSg2kqHFHA.3588@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I am wondering if anyone has the source code (in C# or VB.net) to retrive
> pop emails from the server. Please DO NOT suggest with somesort of
> component
> solution because I can not trust the dlls (sorry for being rude!)
> Thanks in advance. Your help is appreciated.
> Prodip
>
Thanks, Ken. This will give me the needed materials/helps.
Prodip
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:eIqODc1HFHA.2860@.TK2MSFTNGP12.phx.gbl...
> Is there any source code here that suits your needs?
> http://www.gotdotnet.com/community/...aspx?query=pop3
> "Prodip Saha" <psaha@.bear.com> wrote in message
> news:ObSg2kqHFHA.3588@.TK2MSFTNGP14.phx.gbl...
retrive
>

POP3 Mail Retrival- Does any one has source code?

Hi,
I am wondering if anyone has the source code (in C# or VB.net) to retrive
pop emails from the server. Please DO NOT suggest with somesort of component
solution because I can not trust the dlls (sorry for being rude!)

Thanks in advance. Your help is appreciated.
ProdipIs there any source code here that suits your needs?

http://www.gotdotnet.com/community/...aspx?query=pop3

"Prodip Saha" <psaha@.bear.com> wrote in message
news:ObSg2kqHFHA.3588@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I am wondering if anyone has the source code (in C# or VB.net) to retrive
> pop emails from the server. Please DO NOT suggest with somesort of
> component
> solution because I can not trust the dlls (sorry for being rude!)
> Thanks in advance. Your help is appreciated.
> Prodip
Thanks, Ken. This will give me the needed materials/helps.
Prodip
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:eIqODc1HFHA.2860@.TK2MSFTNGP12.phx.gbl...
> Is there any source code here that suits your needs?
> http://www.gotdotnet.com/community/...aspx?query=pop3
> "Prodip Saha" <psaha@.bear.com> wrote in message
> news:ObSg2kqHFHA.3588@.TK2MSFTNGP14.phx.gbl...
> > Hi,
> > I am wondering if anyone has the source code (in C# or VB.net) to
retrive
> > pop emails from the server. Please DO NOT suggest with somesort of
> > component
> > solution because I can not trust the dlls (sorry for being rude!)
> > Thanks in advance. Your help is appreciated.
> > Prodip

POP3 Mail

Hi all

I need to implement a POP3 mail client as part of my project, everything fine from getting emails to read the attachments.

Problem is whenever I am downloading the messages they are no more in server, so I need to save them in local hard drive or database, is there any best approach to achieve this, or some other alternative

Please someone guide me through, thanks in advance for your help

whenever I am downloading the messages they are no more in server ? What it means? how you download the messages ? Using outlook express ?


Hi Thanks for Reply...

Means that they are deleted after downloading(Reading) from server, it's the default behaviour of pop I hope so.i tried with Gmail and inbox.com and retrieving a mail from custom written class by utilizing System.Net.Sockets class, even we can observe the behaviour using telnet.

So I need to save those emails before they got deleted from server, I posted here to know any better approaches to save and retrieve those emails whenever we need(like .eml files) or any thing better approach to handle with out saving them.


So,i decided to store emails(raw data received from pop3 server) in to (.eml) files using .net built in IO streams,when i open (.eml) file with outlook express,it's reading all content and attachments as it is,problem solved,if anybody need how just let me know.

Thanks..


...great and affordable component called 4ASPNet POP3, which does the trick.http://www.4-asp.net/products/pop3.aspx

POP3 Service

Hi.
I need to create an application (service) that will be active in the
background all the time and receive mail. I can't use Microsoft Exchange
Server, I have to make my own. Only problem is that I have no idea how to do
it. Does someone know where could I find some examples or how to do it.
Thanks a lot.PhatCat:
POP3 is a protocol to retrieve mail messages from a mail server. Did
you want your service to poll a mailbox and pull down new messages? Or
did you want your service to listen on a port and actually take emails
via SMTP? (http://www.faqs.org/rfcs/rfc821.html)
Scott
http:// mud
On Tue, 12 Apr 2005 16:22:08 +0200, "PhatCat" <www@.www.com> wrote:

>Hi.
>I need to create an application (service) that will be active in the
>background all the time and receive mail. I can't use Microsoft Exchange
>Server, I have to make my own. Only problem is that I have no idea how to d
o
>it. Does someone know where could I find some examples or how to do it.
>Thanks a lot.
>
I want a sevice to listen on a port and take emails
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:v8go511l59p6s84ro5mupprn5b2r45o3o0@.
4ax.com...
> PhatCat:
> POP3 is a protocol to retrieve mail messages from a mail server. Did
> you want your service to poll a mailbox and pull down new messages? Or
> did you want your service to listen on a port and actually take emails
> via SMTP? (http://www.faqs.org/rfcs/rfc821.html)
> --
> Scott
> http:// mud
> On Tue, 12 Apr 2005 16:22:08 +0200, "PhatCat" <www@.www.com> wrote:
>
>
I don't know of any open source SMTP servers in C# to learn from, you
might consider a free open source package like sendmail :
http://www.sendmail.org/
Scott
On Wed, 13 Apr 2005 00:21:51 +0200, "PhatCat" <www@.www.com> wrote:

>I want a sevice to listen on a port and take emails
>"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
> news:v8go511l59p6s84ro5mupprn5b2r45o3o0@.
4ax.com...
>

POP3 Service

Hi.
I need to create an application (service) that will be active in the
background all the time and receive mail. I can't use Microsoft Exchange
Server, I have to make my own. Only problem is that I have no idea how to do
it. Does someone know where could I find some examples or how to do it.
Thanks a lot.PhatCat:

POP3 is a protocol to retrieve mail messages from a mail server. Did
you want your service to poll a mailbox and pull down new messages? Or
did you want your service to listen on a port and actually take emails
via SMTP? (http://www.faqs.org/rfcs/rfc821.html)

--
Scott
http:// mud

On Tue, 12 Apr 2005 16:22:08 +0200, "PhatCat" <www@.www.com> wrote:

>Hi.
>I need to create an application (service) that will be active in the
>background all the time and receive mail. I can't use Microsoft Exchange
>Server, I have to make my own. Only problem is that I have no idea how to do
>it. Does someone know where could I find some examples or how to do it.
>Thanks a lot.
I want a sevice to listen on a port and take emails

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:v8go511l59p6s84ro5mupprn5b2r45o3o0@.4ax.com...
> PhatCat:
> POP3 is a protocol to retrieve mail messages from a mail server. Did
> you want your service to poll a mailbox and pull down new messages? Or
> did you want your service to listen on a port and actually take emails
> via SMTP? (http://www.faqs.org/rfcs/rfc821.html)
> --
> Scott
> http:// mud
> On Tue, 12 Apr 2005 16:22:08 +0200, "PhatCat" <www@.www.com> wrote:
>>Hi.
>>I need to create an application (service) that will be active in the
>>background all the time and receive mail. I can't use Microsoft Exchange
>>Server, I have to make my own. Only problem is that I have no idea how to
>>do
>>it. Does someone know where could I find some examples or how to do it.
>>Thanks a lot.
>
I don't know of any open source SMTP servers in C# to learn from, you
might consider a free open source package like SendMail :
http://www.sendmail.org/

--
Scott

On Wed, 13 Apr 2005 00:21:51 +0200, "PhatCat" <www@.www.com> wrote:

>I want a sevice to listen on a port and take emails
>"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
>news:v8go511l59p6s84ro5mupprn5b2r45o3o0@.4ax.com...
>> PhatCat:
>>
>> POP3 is a protocol to retrieve mail messages from a mail server. Did
>> you want your service to poll a mailbox and pull down new messages? Or
>> did you want your service to listen on a port and actually take emails
>> via SMTP? (http://www.faqs.org/rfcs/rfc821.html)
>>
>> --
>> Scott
>> http:// mud
>>
>> On Tue, 12 Apr 2005 16:22:08 +0200, "PhatCat" <www@.www.com> wrote:
>>
>>>Hi.
>>>I need to create an application (service) that will be active in the
>>>background all the time and receive mail. I can't use Microsoft Exchange
>>>Server, I have to make my own. Only problem is that I have no idea how to
>>>do
>>>it. Does someone know where could I find some examples or how to do it.
>>>Thanks a lot.
>>>
>

pop3 webmail open source

I am serching "pop3 webmail open source" which i can use it as a outlook.
I have searched sourceforge.net and many other sites for the pop3 webmail open source but could not
got the exact I want.could any body help me out of this problem..
Help expected
PANKAJsearch msdn.microsoft.com

there sample on there that has full code for running pop3 / smtp
i've got the source on my computer somewhere, but you may want to go to microsoft anyway to see if there are any updates, etc.

Poping up a window using timers

Hi,

I need to pop up a window 10 mins after a user logs in with some message. how can i do that using timers. please help

thanks

setTimeout("SendMessage()",600000);

function SendMessage(){

alert('message you want to send');

}

The second parameter of setTimeout is the time delay. It is in miliseconds.

Poping up a window AND redirecting the page thtat triggered the po

Hi to all. I'm having trouble with the following situation:
I have a page where the user inserts some stuff and when he clicks on the
submit button a popup window showing that info is launched and the page "A"
where he was is redirected to another page, page "B". This page "B" can also
be accessed by other means. Can this be done? If so, how?
I was trying to do this:
protected void button_Click(object sender, EventArgs e)
{
string popupScript = String.Format("<script language='javascript'>" +
"window.open('ShowReport.ashx','CustomPopUp'," +
"'width=600, height=500, menubar=no, resizable=yes,
toolbar=no,
location=no, statusbar=no, left=212, top=184')</script>");
Page.RegisterStartupScript("ShowReport", popupScript);
Page.Response.Redirect("NewPage.aspx");
}
But what happens is that I get imediatly redirected to the NewPage.aspx. If
I'm not wrong, this happens because the current page isn't reloaded after
this event is treated. What I am asking is, for the effect I want (both the
pop-up and the redirect occurs) what can I do? I have also thought on trying
to open the pop-up on the loading of NewPage.aspx, by passing some specific
value when I make the redirect (something like
Response.Redirect("NewPage.aspx?popup=yes").
Any ideas/sugestions?
Thanks in advanceHi Ricardo,
The popup window must be generated on the client. This means that the page
must be loaded to generate the popup. What you can do is to have the page
pop up a window, and then submit back to the server, where the Redirect can
occur.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Ricardo Videira" <RicardoVideira@.discussions.microsoft.com> wrote in
message news:2ABEC8F1-C366-4934-BE57-01641826EA8F@.microsoft.com...
> Hi to all. I'm having trouble with the following situation:
> I have a page where the user inserts some stuff and when he clicks on the
> submit button a popup window showing that info is launched and the page
> "A"
> where he was is redirected to another page, page "B". This page "B" can
> also
> be accessed by other means. Can this be done? If so, how?
> I was trying to do this:
> protected void button_Click(object sender, EventArgs e)
> {
> string popupScript = String.Format("<script
> language='javascript'>" +
> "window.open('ShowReport.ashx','CustomPopUp'," +
> "'width=600, height=500, menubar=no, resizable=yes,
> toolbar=no,
> location=no, statusbar=no, left=212, top=184')</script>");
> Page.RegisterStartupScript("ShowReport", popupScript);
> Page.Response.Redirect("NewPage.aspx");
> }
>
> But what happens is that I get imediatly redirected to the NewPage.aspx.
> If
> I'm not wrong, this happens because the current page isn't reloaded after
> this event is treated. What I am asking is, for the effect I want (both
> the
> pop-up and the redirect occurs) what can I do? I have also thought on
> trying
> to open the pop-up on the loading of NewPage.aspx, by passing some
> specific
> value when I make the redirect (something like
> Response.Redirect("NewPage.aspx?popup=yes").
> Any ideas/sugestions?
> Thanks in advance
>
if a page has a redirect header (produced by calling Redirect), the browser
will not render the html, if you want the html rendered, you need to use a
meta tag with a refresh. also popup blocks will prevent you popup window
anyway. you should change the button to a html hyperlink that opens the
report.
-- bruce (sqlwork.com)
"Ricardo Videira" <RicardoVideira@.discussions.microsoft.com> wrote in
message news:2ABEC8F1-C366-4934-BE57-01641826EA8F@.microsoft.com...
> Hi to all. I'm having trouble with the following situation:
> I have a page where the user inserts some stuff and when he clicks on the
> submit button a popup window showing that info is launched and the page
> "A"
> where he was is redirected to another page, page "B". This page "B" can
> also
> be accessed by other means. Can this be done? If so, how?
> I was trying to do this:
> protected void button_Click(object sender, EventArgs e)
> {
> string popupScript = String.Format("<script
> language='javascript'>" +
> "window.open('ShowReport.ashx','CustomPopUp'," +
> "'width=600, height=500, menubar=no, resizable=yes,
> toolbar=no,
> location=no, statusbar=no, left=212, top=184')</script>");
> Page.RegisterStartupScript("ShowReport", popupScript);
> Page.Response.Redirect("NewPage.aspx");
> }
>
> But what happens is that I get imediatly redirected to the NewPage.aspx.
> If
> I'm not wrong, this happens because the current page isn't reloaded after
> this event is treated. What I am asking is, for the effect I want (both
> the
> pop-up and the redirect occurs) what can I do? I have also thought on
> trying
> to open the pop-up on the loading of NewPage.aspx, by passing some
> specific
> value when I make the redirect (something like
> Response.Redirect("NewPage.aspx?popup=yes").
> Any ideas/sugestions?
> Thanks in advance
>

Poplulating Text Field with DropDown selection

Hi folks. Here's a simple question. Trying to populate some text fields based on a dropdown menu selection, but it doesn't work. When a selection is made in the dropdown menu, it seems to default to the selectedValue =2. Not sure why. Any advice would be much appreciated. Thanks! Here's the code:

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { TextBox1.Text =""; TextBox2.Text =""; TextBox3.Text ="";if (DropDownList1.SelectedValue =="0") TextBox1.Text ="blah";if (DropDownList1.SelectedValue =="1") TextBox1.Text ="blahblah";if (DropDownList1.SelectedValue =="2") TextBox1.Text ="blahblahblah"; }

Are you dynamicalluy populating the dropdown list in your code behind? If you are, the Page_OnLoad event is running which is populating your dropdownlist on every postback. To make sure this doesnt happen, you should populate when teh page is not posted back. in other words...

if(!Page.IsPostback){// populate my dropdownlist}

If you are not dynamically populating the dropdownlist, please make sure your viewstate is turned on, that way the server knows that index to preserve when the page is loaded again.

EnableViewState="true"

Hope this helps.


If you are adding the items to the dropdown through code in Page_Load then check if they are inside If (!Ispostback) block.


hi..

i think u can have a break point in the page load or start of selected index changed event..

and find the value..

if not..

check in the design view that item 2 isSelected=true..

correct me if i'm wrong..


Thanks to all for the suggestions. The dropDownList was statically populated from the control properties in the ASPX page. I tinkered with this for a long while, but could NOT get it to work. So, I changed approach and populated the list by making an array in the code, and now it works as designed. Thanks again. Here is the code, in case anybody is interested.

protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {// 2 dimensional array for dropDown liststring[,] forms = { {"blah","0"}, {"blah blah","1"}, {"blah blah blah","2"} };// populate listfor (int i = 0; i < forms.GetLength(0); i++) {//add both text and value DropDownList1.Items.Add(new ListItem(forms[i, 0], forms[i, 1])); } } }protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) {if (DropDownList1.SelectedIndex != -1) { TextBox1.Text = DropDownList1.SelectedItem.Text; } }

FYI... regarding the orginal post, the reason the textBox wasn't populated correctly was a simple syntax error. Used cascading IF statement without ELSE IF or switch statement.

Popping up a window

Hi,

I'm writing a page in asp.net to post something to a website and I'm trying to add a preview button to the page. The problem with the code lies in popping up a window containing the preview. The onClick event of the asp:button runs a subroutine to create a new text file, 'temp.txt' (using a Try... Catch statement). Once this is done, I have added the following line:
message.Text = "<script language=Javascript>window.open('disp_report.asp?temp.txt');</script>", where message is an asp:label. This results in a Compilation Error saying 'Try statement must end with an 'End Try', almost as if the line of code was an unterminated string. Commenting out the line (with a ') results in the same error.

Any ideas?Can you post your code as you have it in the IDE?
How much do you want? The whole page?
Here's the page (attached). The line of code I mentioned is commented out at the bottom of the Preview_Click subroutine. It still causes the error, though. For the moment, I've got the message label showing a hyperlink to view the preview, which is a bit messy, but works.
I cant get the attachment, says invalid. Can you make it a textfile?
Done before you posted ;)
Ah, ok. I was getting the forums source for this page :lol:
Let me see what you got now.
I edited the post with the aspx attachment, removed that and added the text file instead.
Don't set the label's text to that script.

To popup a window, in the button's click event, after generating the file, do this:

Page.RegisterStartupScript("script1","<script language=Javascript>window.open('disp_report.asp?temp.txt');</script>")

That is the way to do it.
Thanks for helping froggy. I was stuck on this.

I fed you earlier so you'll have to wait for the next mealtime. :D
In case you haven't noticed by now, I like microwaved cheese sandwiches :afrog:
Thanks for that.

How do I then remove the Startup script so that it doesn't fire again when they click Save?
No, that hasn't worked... still giving me the same error.

Putting it outside of the Try statement throws up:
'BC30648: String constants must end with a double quote.'

And the calendar control keeps going Italian on me!
Okay, building up the string gradually has shown that the problem seems to be with the final ">". However,
Dim strScript As String
strScript = "<script language=Javascript>window.open('disp_report.asp?temp.txt');</script" & ">"
Page.RegisterStartupScript("script1", strScript) seems to work.

Weird...

This still isn't giving me a popup, either. Searching the page source after the button has been clicked shows that the script is there, right after the 'Temporary match report created...' on the page. Any more ideas?

**Edit**

Turns out, the popup works fine - Norton Internet Security is just blocking it! Any way round this? I'm still having the Italian calendar problem, too.
Any popup blockers in place?
Norton Internet Security is the culprit. Is there any way round this? I can add an exception on my computer, but it's not really feasible for everyone visiting using Norton to do.

I'm still getting the Italian calendar from time to time, too!
For the first part, do you really need the popup to open when the page reloads, or can you have it when the user clicks on the link? Things could be easier if it's on the link click.

For the second part, how Italian is it? Is it romancing you?
Well, it would look better if the page popped up, but it's not essential.

As for the calendar, I've attached an image.
Oh, it's going Italian on you, literally.

I thought you were using a cliche or euphemism for "It's trying to kill me." :sick:

For the calendar, check your regional settings in Control Panel.
My regional settings are fine. It's just bizarre that the calendar control is only sometimes Italian... It's something like 1 time in 5 that it appears like that!

**Edit**

The following lines of code seem to have fixed it:

Sub Page_Load()
Dim lang As System.Globalization.CultureInfo
lang = New System.Globalization.CultureInfo("en-gb")
System.Threading.Thread.CurrentThread.CurrentCulture = lang
System.Threading.Thread.CurrentThread.CurrentUICulture = lang
End Sub

Back to the original question - can you think of a reason why I had to concatenate on the last '>' like that?
No, I can't think of any. You shouldn't even have to do that. It maybe a simple double quote problem that we're overlooking.
Dont you need to use the escape char when using the "/"?
Not for asp.net, surely? It should treat everything within the quotation marks as a string literal and that's it...
The escape characters would be in use in C# codebehind, but he's got VB.NET there.
Dont you need the escpae char for the JavaScript is what I was meaning.
If it were in the javascript code itself, yes. :D
Well, I suppose I should mark this resolved. We got the popup going, although no resolution about that last '>'. I've actually seen that in some code before - where it's added on at the end, but there was no explanation as to why. I just thought, 'that looks pointless...' and left it at that.

Popping opening a mail client and pass a subject parameter...

Hi:

Is there a way to pop open a mail client and pass in a text string for the
subject and possibly other parts of a standard mail message? The "mailto:"
attribute of hyplerlink leaves these blank.

Thanks,
Charlieread up on the mailto: link, it does have a &Subject='text'&Body='text'
attribute IIRC

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com

"Charlie@.CBFC" <charle1@.comcast.net> wrote in message
news:eSlBhiR4DHA.1752@.tk2msftngp13.phx.gbl...
> Hi:
> Is there a way to pop open a mail client and pass in a text string for the
> subject and possibly other parts of a standard mail message? The
"mailto:"
> attribute of hyplerlink leaves these blank.
> Thanks,
> Charlie

Populate .net dropdown

I have 2 tables. One is country and holds a list of countries and the other
is region which holds a list of states/provinces/countys relating to that
country.

How do I populate a combo so that it is indented.

e.g

USA
-Florida
-California
-Utah
Canada
-Ontario
-Quebec
England
-Kent
-Northumberland

TIAYou get real familiar with the dropdownlist.add() method, because this isn't
something you are going to acheive with the standard way of doing things.
First you have to design a query to return
countries/states/provinces/countys sorted by country, then you have to loop
through them, set some variable to the current country, and then pop either
a Country, or a state/province/county in the dropdownlist using the .add
method. If it is a state/province/county you'll probably need to add
something to the beginning to actually indent it. Then you'll have the
problem of finding out if they selected a country or a
state/province/county.

sounds fun!

"Poppy" <paul.diamond@.NOSPAMthemedialounge.com> wrote in message
news:%23ndPZP32DHA.556@.TK2MSFTNGP11.phx.gbl...
> I have 2 tables. One is country and holds a list of countries and the
other
> is region which holds a list of states/provinces/countys relating to that
> country.
> How do I populate a combo so that it is indented.
> e.g
> USA
> -Florida
> -California
> -Utah
> Canada
> -Ontario
> -Quebec
> England
> -Kent
> -Northumberland
> TIA

Populate 2 or more datagrids from one OleDBCommand

Hi All,

I wish to populate more than one datagrid from the same OleDBCommand. The
code I have is:

Dim objCmd As New OleDbCommand(strSql, objConn)

Then...

Me.dgTariffHolidayHomesBand1.DataSource = objCmd.ExecuteReader()
Me.dgTariffHolidayHomesBand1.Visible = True
Me.dgTariffHolidayHomesBand2.DataSource = objCmd.ExecuteReader()
Me.dgTariffHolidayHomesBand2.Visible = True

I get this error when the second call to objCmd.ExecuteReader() is called:
System.InvalidOperationException: ExecuteReader requires an open and
available Connection.

The reason for populating multiple grids from the same data, is that I am
calling ALL columns in the SQL, and then using (for example) columns A and
B
in DG1, C and D in DG2...and so on.

Surely I don't need a new recordset for each datagrid?

Simon.There are a couple problems with your approach.

First, the ExecuteReader method requires that you close and re-open the
connection, just as the code implies but you can't use a DataReader as the
DataSource for a DataGrid. You need something that implements IList or
IListSource. You can research both of those interfaces in the MSDN Library
to see what classes implement them.

Another problem is that you're making two queries to the database and
populating the DataGrids sequentially. What happens if the data changes
between calls? You can't be sure the data in the DataGrids will match.
What you need to do is get the data once, using a DataSet or even a
DataTable and set both DataGrids to use the same DataSource.

Hope this helps,

DalePres
MCAD, MCSE, MCDBA

"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:ODOqdixBFHA.1400@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I wish to populate more than one datagrid from the same OleDBCommand. The
> code I have is:
> Dim objCmd As New OleDbCommand(strSql, objConn)
> Then...
> Me.dgTariffHolidayHomesBand1.DataSource = objCmd.ExecuteReader()
> Me.dgTariffHolidayHomesBand1.Visible = True
> Me.dgTariffHolidayHomesBand2.DataSource = objCmd.ExecuteReader()
> Me.dgTariffHolidayHomesBand2.Visible = True
> I get this error when the second call to objCmd.ExecuteReader() is called:
> System.InvalidOperationException: ExecuteReader requires an open and
> available Connection.
> The reason for populating multiple grids from the same data, is that I am
> calling ALL columns in the SQL, and then using (for example) columns A and
> B
> in DG1, C and D in DG2...and so on.
> Surely I don't need a new recordset for each datagrid?
> Simon.

Populate 2 or more datagrids from one OleDBCommand

Hi All,
I wish to populate more than one datagrid from the same OleDBCommand. The
code I have is:
Dim objCmd As New OleDbCommand(strSql, objConn)
Then...
Me.dgTariffHolidayHomesBand1.DataSource = objCmd.ExecuteReader()
Me.dgTariffHolidayHomesBand1.Visible = True
Me.dgTariffHolidayHomesBand2.DataSource = objCmd.ExecuteReader()
Me.dgTariffHolidayHomesBand2.Visible = True
I get this error when the second call to objCmd.ExecuteReader() is called:
System.InvalidOperationException: ExecuteReader requires an open and
available Connection.
The reason for populating multiple grids from the same data, is that I am
calling ALL columns in the SQL, and then using (for example) columns A and
B
in DG1, C and D in DG2...and so on.
Surely I don't need a new recordset for each datagrid?
Simon.There are a couple problems with your approach.
First, the ExecuteReader method requires that you close and re-open the
connection, just as the code implies but you can't use a DataReader as the
DataSource for a DataGrid. You need something that implements IList or
IListSource. You can research both of those interfaces in the MSDN Library
to see what classes implement them.
Another problem is that you're making two queries to the database and
populating the DataGrids sequentially. What happens if the data changes
between calls? You can't be sure the data in the DataGrids will match.
What you need to do is get the data once, using a DataSet or even a
DataTable and set both DataGrids to use the same DataSource.
Hope this helps,
DalePres
MCAD, MCSE, MCDBA
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:ODOqdixBFHA.1400@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> I wish to populate more than one datagrid from the same OleDBCommand. The
> code I have is:
> Dim objCmd As New OleDbCommand(strSql, objConn)
> Then...
> Me.dgTariffHolidayHomesBand1.DataSource = objCmd.ExecuteReader()
> Me.dgTariffHolidayHomesBand1.Visible = True
> Me.dgTariffHolidayHomesBand2.DataSource = objCmd.ExecuteReader()
> Me.dgTariffHolidayHomesBand2.Visible = True
> I get this error when the second call to objCmd.ExecuteReader() is called:
> System.InvalidOperationException: ExecuteReader requires an open and
> available Connection.
> The reason for populating multiple grids from the same data, is that I am
> calling ALL columns in the SQL, and then using (for example) columns A and
> B
> in DG1, C and D in DG2...and so on.
> Surely I don't need a new recordset for each datagrid?
> Simon.
>

Populate 2nd dropdown list based on selecteditem in first with out postback?

Hi All:

I have an aspx page that has 2 dropdownlists. I want to populate the second
dropdownlist based on the selecteditem in the first dropdown. I know I can
do this by doing a post back and using the selectedindex and loading the
second dropdownlist.

Is there anyway I can do this without doing a postback? Any ideas/pointers
will be much appreciated.

Thanks!

VinayYou'll have to use JavaScript in the client.

search: dependent listbox

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

"Vinay" <vinay_hs_removethis@.nospam.yahoo.com> wrote in message
news:ef$cOw4oFHA.2976@.TK2MSFTNGP12.phx.gbl...
> Hi All:
> I have an aspx page that has 2 dropdownlists. I want to populate the
> second dropdownlist based on the selecteditem in the first dropdown. I
> know I can do this by doing a post back and using the selectedindex and
> loading the second dropdownlist.
> Is there anyway I can do this without doing a postback? Any ideas/pointers
> will be much appreciated.
> Thanks!
> Vinay
Thanks for the pointer - will do some reading and see if I can implement it.

"clintonG" <csgallagher@.REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:ek$zp%234oFHA.3656@.TK2MSFTNGP09.phx.gbl...
> You'll have to use JavaScript in the client.
> search: dependent listbox
> <%= Clinton Gallagher
> METROmilwaukee (sm) "A Regional Information Service"
> NET csgallagher AT metromilwaukee.com
> URL http://metromilwaukee.com/
> URL http://clintongallagher.metromilwaukee.com/
>
> "Vinay" <vinay_hs_removethis@.nospam.yahoo.com> wrote in message
> news:ef$cOw4oFHA.2976@.TK2MSFTNGP12.phx.gbl...
>> Hi All:
>>
>> I have an aspx page that has 2 dropdownlists. I want to populate the
>> second dropdownlist based on the selecteditem in the first dropdown. I
>> know I can do this by doing a post back and using the selectedindex and
>> loading the second dropdownlist.
>>
>> Is there anyway I can do this without doing a postback? Any
>> ideas/pointers will be much appreciated.
>>
>> Thanks!
>>
>> Vinay
>>

Populate 2nd dropdown list based on selecteditem in first with out postback?

Hi All:
I have an aspx page that has 2 dropdownlists. I want to populate the second
dropdownlist based on the selecteditem in the first dropdown. I know I can
do this by doing a post back and using the selectedindex and loading the
second dropdownlist.
Is there anyway I can do this without doing a postback? Any ideas/pointers
will be much appreciated.
Thanks!
VinayYou'll have to use JavaScript in the client.
search: dependent listbox
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"Vinay" <vinay_hs_removethis@.nospam.yahoo.com> wrote in message
news:ef$cOw4oFHA.2976@.TK2MSFTNGP12.phx.gbl...
> Hi All:
> I have an aspx page that has 2 dropdownlists. I want to populate the
> second dropdownlist based on the selecteditem in the first dropdown. I
> know I can do this by doing a post back and using the selectedindex and
> loading the second dropdownlist.
> Is there anyway I can do this without doing a postback? Any ideas/pointers
> will be much appreciated.
> Thanks!
> Vinay
>
Thanks for the pointer - will do some reading and see if I can implement it.
"clintonG" < csgallagher@.REMOVETHISTEXTmetromilwaukee
.com> wrote in message
news:ek$zp%234oFHA.3656@.TK2MSFTNGP09.phx.gbl...
> You'll have to use JavaScript in the client.
> search: dependent listbox
> <%= Clinton Gallagher
> METROmilwaukee (sm) "A Regional Information Service"
> NET csgallagher AT metromilwaukee.com
> URL http://metromilwaukee.com/
> URL http://clintongallagher.metromilwaukee.com/
>
> "Vinay" <vinay_hs_removethis@.nospam.yahoo.com> wrote in message
> news:ef$cOw4oFHA.2976@.TK2MSFTNGP12.phx.gbl...
>

Populate a DataGrid from Multiple Databases - Order Problem

I have 4 different databases that I'm having to pull data from in order
to populate a datagrid. I am able to do this, but my problem is that
because I'm pulling the data from 4 different databases, the data is
ordered alphabetically but is grouped by database.

Here is an example of what is happening to the data in the datgrid with
the code that I have now.
DB1 Apple
DB1 Bird
DB1 Cake
DB2 Airplane
DB2 Boat
DB2 Circle
DB3 Amazing
DB3 Blue
etc....

I want ALL the data in the datagrid ordered alphabetically, reguardless
of which database it is from.

This is the code that I'm using to bind data to my datagrid. Can I add
something to my code to order the data correctly or do I need to go
about this another way?

Private Sub BindData()

GetConnectionString()

Dim strSQL As String = "SELECT DISTINCT DB_PDESCR, DB_PPROD
FROM PUB.PCFPOLCY "
Dim strWhere As String = ""
Dim strOrderBy As String = ""

Dim tmpID As String = Request.QueryString("ID")

'Ensure that the ID is 4 charactes long
While Len(Trim(tmpID)) < 4
tmpID = "0" & Trim(tmpID)
End While

strWhere = " WHERE DB_PPROD = '" & Trim(tmpID) & "'"
strOrderBy = " ORDER BY DB_PDESCR"
strSQL = strSQL & strWhere & strOrderBy

Dim myDA As New OdbcDataAdapter
Dim myDS As New DataSet
Dim myCommand_amfnat As New OdbcCommand(strSQL,
amfnat_OdbcConnection)
Dim myCommand_msba As New OdbcCommand(strSQL,
msba_OdbcConnection)
Dim myCommand_bcam As New OdbcCommand(strSQL,
bcam_OdbcConnection)
Dim myCommand_afca As New OdbcCommand(strSQL,
afca_OdbcConnection)

'Create the DataAdapter for AMFNAT and Populate the DataSet
myDA.SelectCommand = myCommand_amfnat
myDA.Fill(myDS)

'Create the DataAdapter for MSBA and Populate the DataSet
myDA.SelectCommand = myCommand_msba
myDA.Fill(myDS)

'Create the DataAdapter for BCAM and Populate the DataSet
myDA.SelectCommand = myCommand_bcam
myDA.Fill(myDS)

'Create the DataAdapter for AFCA and Populate the DataSet
myDA.SelectCommand = myCommand_afca
myDA.Fill(myDS)

'Set the datagrid's datasource to the dataset and databind
dgAllCompanies.DataSource = myDS
dgAllCompanies.DataBind()

'Display error message if there are no records.
If myDS.Tables(0).Rows.Count = 0 Then
lblNoResults.Visible = True
dgAllCompanies.Visible = False
Else
lblNoResults.Visible = False
dgAllCompanies.Visible = True
End If

''*** Clean Up
myDS.Dispose()
myDS = Nothing

myDA.Dispose()
myDA = Nothing

myCommand_amfnat.Dispose()
myCommand_amfnat = Nothing

myCommand_msba.Dispose()
myCommand_msba = Nothing

myCommand_bcam.Dispose()
myCommand_bcam = Nothing

myCommand_afca.Dispose()
myCommand_afca = Nothing

End Sub

Thanks for taking the time to look at my problem!
Crjunkyou can create your own custom class and implement icomparable interface
, then use arraylist to bind data to datagrid

crjunk wrote:
> I have 4 different databases that I'm having to pull data from in order
> to populate a datagrid. I am able to do this, but my problem is that
> because I'm pulling the data from 4 different databases, the data is
> ordered alphabetically but is grouped by database.
> Here is an example of what is happening to the data in the datgrid with
> the code that I have now.
> DB1 Apple
> DB1 Bird
> DB1 Cake
> DB2 Airplane
> DB2 Boat
> DB2 Circle
> DB3 Amazing
> DB3 Blue
> etc....
> I want ALL the data in the datagrid ordered alphabetically, reguardless
> of which database it is from.
> This is the code that I'm using to bind data to my datagrid. Can I add
> something to my code to order the data correctly or do I need to go
> about this another way?
> Private Sub BindData()
> GetConnectionString()
> Dim strSQL As String = "SELECT DISTINCT DB_PDESCR, DB_PPROD
> FROM PUB.PCFPOLCY "
> Dim strWhere As String = ""
> Dim strOrderBy As String = ""
> Dim tmpID As String = Request.QueryString("ID")
> 'Ensure that the ID is 4 charactes long
> While Len(Trim(tmpID)) < 4
> tmpID = "0" & Trim(tmpID)
> End While
> strWhere = " WHERE DB_PPROD = '" & Trim(tmpID) & "'"
> strOrderBy = " ORDER BY DB_PDESCR"
> strSQL = strSQL & strWhere & strOrderBy
> Dim myDA As New OdbcDataAdapter
> Dim myDS As New DataSet
> Dim myCommand_amfnat As New OdbcCommand(strSQL,
> amfnat_OdbcConnection)
> Dim myCommand_msba As New OdbcCommand(strSQL,
> msba_OdbcConnection)
> Dim myCommand_bcam As New OdbcCommand(strSQL,
> bcam_OdbcConnection)
> Dim myCommand_afca As New OdbcCommand(strSQL,
> afca_OdbcConnection)
> 'Create the DataAdapter for AMFNAT and Populate the DataSet
> myDA.SelectCommand = myCommand_amfnat
> myDA.Fill(myDS)
> 'Create the DataAdapter for MSBA and Populate the DataSet
> myDA.SelectCommand = myCommand_msba
> myDA.Fill(myDS)
> 'Create the DataAdapter for BCAM and Populate the DataSet
> myDA.SelectCommand = myCommand_bcam
> myDA.Fill(myDS)
> 'Create the DataAdapter for AFCA and Populate the DataSet
> myDA.SelectCommand = myCommand_afca
> myDA.Fill(myDS)
> 'Set the datagrid's datasource to the dataset and databind
> dgAllCompanies.DataSource = myDS
> dgAllCompanies.DataBind()
> 'Display error message if there are no records.
> If myDS.Tables(0).Rows.Count = 0 Then
> lblNoResults.Visible = True
> dgAllCompanies.Visible = False
> Else
> lblNoResults.Visible = False
> dgAllCompanies.Visible = True
> End If
> ''*** Clean Up
> myDS.Dispose()
> myDS = Nothing
> myDA.Dispose()
> myDA = Nothing
> myCommand_amfnat.Dispose()
> myCommand_amfnat = Nothing
> myCommand_msba.Dispose()
> myCommand_msba = Nothing
> myCommand_bcam.Dispose()
> myCommand_bcam = Nothing
> myCommand_afca.Dispose()
> myCommand_afca = Nothing
> End Sub
>
> Thanks for taking the time to look at my problem!
> Crjunk
If you can put whole data from four databases into one
datatable, you can use dataview's (=
datatable.DefaultView) Sort property to sort all data.
Then you bind datagrid with the sorted dataview. It shows
alphabetically ordered data.

HTH

Elton Wang
elton_wang@.hotmail.com

>--Original Message--
>I have 4 different databases that I'm having to pull data
from in order
>to populate a datagrid. I am able to do this, but my
problem is that
>because I'm pulling the data from 4 different databases,
the data is
>ordered alphabetically but is grouped by database.
>Here is an example of what is happening to the data in
the datgrid with
>the code that I have now.
>DB1 Apple
>DB1 Bird
>DB1 Cake
>DB2 Airplane
>DB2 Boat
>DB2 Circle
>DB3 Amazing
>DB3 Blue
>etc....
>I want ALL the data in the datagrid ordered
alphabetically, reguardless
>of which database it is from.
>This is the code that I'm using to bind data to my
datagrid. Can I add
>something to my code to order the data correctly or do I
need to go
>about this another way?
> Private Sub BindData()
> GetConnectionString()
> Dim strSQL As String = "SELECT DISTINCT
DB_PDESCR, DB_PPROD
>FROM PUB.PCFPOLCY "
> Dim strWhere As String = ""
> Dim strOrderBy As String = ""
> Dim tmpID As String = Request.QueryString("ID")
> 'Ensure that the ID is 4 charactes long
> While Len(Trim(tmpID)) < 4
> tmpID = "0" & Trim(tmpID)
> End While
> strWhere = " WHERE DB_PPROD = '" & Trim(tmpID)
& "'"
> strOrderBy = " ORDER BY DB_PDESCR"
> strSQL = strSQL & strWhere & strOrderBy
> Dim myDA As New OdbcDataAdapter
> Dim myDS As New DataSet
> Dim myCommand_amfnat As New OdbcCommand(strSQL,
>amfnat_OdbcConnection)
> Dim myCommand_msba As New OdbcCommand(strSQL,
>msba_OdbcConnection)
> Dim myCommand_bcam As New OdbcCommand(strSQL,
>bcam_OdbcConnection)
> Dim myCommand_afca As New OdbcCommand(strSQL,
>afca_OdbcConnection)
> 'Create the DataAdapter for AMFNAT and Populate
the DataSet
> myDA.SelectCommand = myCommand_amfnat
> myDA.Fill(myDS)
> 'Create the DataAdapter for MSBA and Populate the
DataSet
> myDA.SelectCommand = myCommand_msba
> myDA.Fill(myDS)
> 'Create the DataAdapter for BCAM and Populate the
DataSet
> myDA.SelectCommand = myCommand_bcam
> myDA.Fill(myDS)
> 'Create the DataAdapter for AFCA and Populate the
DataSet
> myDA.SelectCommand = myCommand_afca
> myDA.Fill(myDS)
> 'Set the datagrid's datasource to the dataset and
databind
> dgAllCompanies.DataSource = myDS
> dgAllCompanies.DataBind()
> 'Display error message if there are no records.
> If myDS.Tables(0).Rows.Count = 0 Then
> lblNoResults.Visible = True
> dgAllCompanies.Visible = False
> Else
> lblNoResults.Visible = False
> dgAllCompanies.Visible = True
> End If
> ''*** Clean Up
> myDS.Dispose()
> myDS = Nothing
> myDA.Dispose()
> myDA = Nothing
> myCommand_amfnat.Dispose()
> myCommand_amfnat = Nothing
> myCommand_msba.Dispose()
> myCommand_msba = Nothing
> myCommand_bcam.Dispose()
> myCommand_bcam = Nothing
> myCommand_afca.Dispose()
> myCommand_afca = Nothing
> End Sub
>
>Thanks for taking the time to look at my problem!
>Crjunk
>.
Thanks Elton and ashish. I figured out that I could use a DataView
before I read your message after doing a bunch of searching. Thanks
for your help. Here is what I added/changed in my code.

'Create a DataView so that I can order the data before the
DataGrid is populated.
'Otherwise the data will be in alphabetical order in DataGrid,
but grouped by DataBase.
Dim dvArrange As DataView = myDS.Tables(0).DefaultView
dvArrange.Sort = "DB_PDESCR"

'Set the datagrid's datasource to the DataView and bind data.
dgAllCompanies.DataSource = dvArrange
dgAllCompanies.DataBind()

Monday, March 26, 2012

Populate a DataGrid from Multiple Databases - Order Problem

I have 4 different databases that I'm having to pull data from in order
to populate a datagrid. I am able to do this, but my problem is that
because I'm pulling the data from 4 different databases, the data is
ordered alphabetically but is grouped by database.
Here is an example of what is happening to the data in the datgrid with
the code that I have now.
DB1 Apple
DB1 Bird
DB1 Cake
DB2 Airplane
DB2 Boat
DB2 Circle
DB3 Amazing
DB3 Blue
etc....
I want ALL the data in the datagrid ordered alphabetically, reguardless
of which database it is from.
This is the code that I'm using to bind data to my datagrid. Can I add
something to my code to order the data correctly or do I need to go
about this another way?
Private Sub BindData()
GetConnectionString()
Dim strSQL As String = "SELECT DISTINCT DB_PDESCR, DB_PPROD
FROM PUB.PCFPOLCY "
Dim strWhere As String = ""
Dim strOrderBy As String = ""
Dim tmpID As String = Request.QueryString("ID")
'Ensure that the ID is 4 charactes long
While Len(Trim(tmpID)) < 4
tmpID = "0" & Trim(tmpID)
End While
strWhere = " WHERE DB_PPROD = '" & Trim(tmpID) & "'"
strOrderBy = " ORDER BY DB_PDESCR"
strSQL = strSQL & strWhere & strOrderBy
Dim myDA As New OdbcDataAdapter
Dim myDS As New DataSet
Dim myCommand_amfnat As New OdbcCommand(strSQL,
amfnat_OdbcConnection)
Dim myCommand_msba As New OdbcCommand(strSQL,
msba_OdbcConnection)
Dim myCommand_bcam As New OdbcCommand(strSQL,
bcam_OdbcConnection)
Dim myCommand_afca As New OdbcCommand(strSQL,
afca_OdbcConnection)
'Create the DataAdapter for AMFNAT and Populate the DataSet
myDA.SelectCommand = myCommand_amfnat
myDA.Fill(myDS)
'Create the DataAdapter for MSBA and Populate the DataSet
myDA.SelectCommand = myCommand_msba
myDA.Fill(myDS)
'Create the DataAdapter for BCAM and Populate the DataSet
myDA.SelectCommand = myCommand_bcam
myDA.Fill(myDS)
'Create the DataAdapter for AFCA and Populate the DataSet
myDA.SelectCommand = myCommand_afca
myDA.Fill(myDS)
'Set the datagrid's datasource to the dataset and databind
dgAllCompanies.DataSource = myDS
dgAllCompanies.DataBind()
'Display error message if there are no records.
If myDS.Tables(0).Rows.Count = 0 Then
lblNoResults.Visible = True
dgAllCompanies.Visible = False
Else
lblNoResults.Visible = False
dgAllCompanies.Visible = True
End If
''*** Clean Up
myDS.Dispose()
myDS = Nothing
myDA.Dispose()
myDA = Nothing
myCommand_amfnat.Dispose()
myCommand_amfnat = Nothing
myCommand_msba.Dispose()
myCommand_msba = Nothing
myCommand_bcam.Dispose()
myCommand_bcam = Nothing
myCommand_afca.Dispose()
myCommand_afca = Nothing
End Sub
Thanks for taking the time to look at my problem!
Crjunkyou can create your own custom class and implement icomparable interface
, then use arraylist to bind data to datagrid
crjunk wrote:
> I have 4 different databases that I'm having to pull data from in order
> to populate a datagrid. I am able to do this, but my problem is that
> because I'm pulling the data from 4 different databases, the data is
> ordered alphabetically but is grouped by database.
> Here is an example of what is happening to the data in the datgrid with
> the code that I have now.
> DB1 Apple
> DB1 Bird
> DB1 Cake
> DB2 Airplane
> DB2 Boat
> DB2 Circle
> DB3 Amazing
> DB3 Blue
> etc....
> I want ALL the data in the datagrid ordered alphabetically, reguardless
> of which database it is from.
> This is the code that I'm using to bind data to my datagrid. Can I add
> something to my code to order the data correctly or do I need to go
> about this another way?
> Private Sub BindData()
> GetConnectionString()
> Dim strSQL As String = "SELECT DISTINCT DB_PDESCR, DB_PPROD
> FROM PUB.PCFPOLCY "
> Dim strWhere As String = ""
> Dim strOrderBy As String = ""
> Dim tmpID As String = Request.QueryString("ID")
> 'Ensure that the ID is 4 charactes long
> While Len(Trim(tmpID)) < 4
> tmpID = "0" & Trim(tmpID)
> End While
> strWhere = " WHERE DB_PPROD = '" & Trim(tmpID) & "'"
> strOrderBy = " ORDER BY DB_PDESCR"
> strSQL = strSQL & strWhere & strOrderBy
> Dim myDA As New OdbcDataAdapter
> Dim myDS As New DataSet
> Dim myCommand_amfnat As New OdbcCommand(strSQL,
> amfnat_OdbcConnection)
> Dim myCommand_msba As New OdbcCommand(strSQL,
> msba_OdbcConnection)
> Dim myCommand_bcam As New OdbcCommand(strSQL,
> bcam_OdbcConnection)
> Dim myCommand_afca As New OdbcCommand(strSQL,
> afca_OdbcConnection)
> 'Create the DataAdapter for AMFNAT and Populate the DataSet
> myDA.SelectCommand = myCommand_amfnat
> myDA.Fill(myDS)
> 'Create the DataAdapter for MSBA and Populate the DataSet
> myDA.SelectCommand = myCommand_msba
> myDA.Fill(myDS)
> 'Create the DataAdapter for BCAM and Populate the DataSet
> myDA.SelectCommand = myCommand_bcam
> myDA.Fill(myDS)
> 'Create the DataAdapter for AFCA and Populate the DataSet
> myDA.SelectCommand = myCommand_afca
> myDA.Fill(myDS)
> 'Set the datagrid's datasource to the dataset and databind
> dgAllCompanies.DataSource = myDS
> dgAllCompanies.DataBind()
> 'Display error message if there are no records.
> If myDS.Tables(0).Rows.Count = 0 Then
> lblNoResults.Visible = True
> dgAllCompanies.Visible = False
> Else
> lblNoResults.Visible = False
> dgAllCompanies.Visible = True
> End If
> ''*** Clean Up
> myDS.Dispose()
> myDS = Nothing
> myDA.Dispose()
> myDA = Nothing
> myCommand_amfnat.Dispose()
> myCommand_amfnat = Nothing
> myCommand_msba.Dispose()
> myCommand_msba = Nothing
> myCommand_bcam.Dispose()
> myCommand_bcam = Nothing
> myCommand_afca.Dispose()
> myCommand_afca = Nothing
> End Sub
>
> Thanks for taking the time to look at my problem!
> Crjunk
>
Thanks Elton and ashish. I figured out that I could use a DataView
before I read your message after doing a bunch of searching. Thanks
for your help. Here is what I added/changed in my code.
'Create a DataView so that I can order the data before the
DataGrid is populated.
'Otherwise the data will be in alphabetical order in DataGrid,
but grouped by DataBase.
Dim dvArrange As DataView = myDS.Tables(0).DefaultView
dvArrange.Sort = "DB_PDESCR"
'Set the datagrid's datasource to the DataView and bind data.
dgAllCompanies.DataSource = dvArrange
dgAllCompanies.DataBind()