Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Thursday, March 29, 2012

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

Saturday, March 24, 2012

Populate Dropdown with File Names

I'm working with an ASP.Net web page that's using C#. I'm trying to
populate a Dropdown with the File Names that reside in an image folder
that's in the same project. So far all I've been able to find is the
below code...and even then that's not quite what I'm after.

DirectoryInfo di = new DirectoryInfo(@dotnet.itags.org."~/Images/Entry/");
FileInfo[] fis = di.GetFiles();
DropDownList5.DataSource = fis;
DropDownList5.DataTextField = "Name";
DropDownList5.DataValueField = "Name";
DropDownList5.DataBind();

Any help in trying to get this resolved quickly would be appreciated.

ThanksOne thing I neglected to say...the Dropdown will also reside in the
EditItemTemplate of a Formview. Is there a way to bind that control if
it's there?

Thanks Again

Dave wrote:

Quote:

Originally Posted by

I'm working with an ASP.Net web page that's using C#. I'm trying to
populate a Dropdown with the File Names that reside in an image folder
that's in the same project. So far all I've been able to find is the
below code...and even then that's not quite what I'm after.
>
DirectoryInfo di = new DirectoryInfo(@."~/Images/Entry/");
FileInfo[] fis = di.GetFiles();
DropDownList5.DataSource = fis;
DropDownList5.DataTextField = "Name";
DropDownList5.DataValueField = "Name";
DropDownList5.DataBind();
>
Any help in trying to get this resolved quickly would be appreciated.
>
Thanks

Wednesday, March 21, 2012

populating & Submitting an external form

Hey All,

In windows forms this can be done using the microsoft web browser control, but how is it done in asp.net either using the axwebbrowser control or httpwebrequest methods

this is an example description only actul sites and stuff will be different

I want my web site to do a search on google so on my site the user enters the input value into a text box, and they press send data.
This is then passed to google via some kind of magic, (ie webrequest) and we populate the google input box and press the search button, when we get our results back from google, i run the response via my regular expression and display the results in my own format.

I dont actully want to spider googles results its just the method is the closest description i can give to what i want to do.

I have been looking at posting data with the httpwebrequest and response methods but im not sure on it.

Can someone advise of the best possible method to handle such events

regards

Carlbump
Try the Google Web Services, even the free subscription allows you loads of searches.
You just make your own pages but use Google to do the searches, very straightforward.
i did say that i only was using google as an example

Friday, March 16, 2012

Populating a DropDownList with a Data Method Code Wizard

Please help... I am sure most of you guys know the answer to this basic question

I am using the Web Matrix ...Getting Started Manual and am to the

Using a Data Method Code Wizard to Populate a DropDownList.

The question is : When asked to Remove the Button1_Click event code...

How is this done? Do I remove the entire code?? And where is the event code?

Sub Button1_Click(sender As Object, e As EventArgs)
DataList1.DataSource = GetOrderDetails(CInt(TextBox1.Text))
DataList1.DataBind()
End SubIn WebMatrix, new events are automatically hooked up to event handlers declaratively. So, after creating a method that handles a Button webcontrol's OnClick event, you'll have something like this in your HTML view:


<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>

In this example, the 'onclick' attribute's value identifies the name of the method that handles this control's Click event.

So, if you want to unhook an method from an event in Web Matrix, the simplest way to do this is to remove the corresponding event's attribute on that control's tag. What you do with the method's code after that is entirely up to you.

Hope this helps!
No..this did not help..but thanks anyway. Could you please go to the following URL and see what I mean.

http://www.asp.net/webmatrix/guidedtour/section4/ddlcodebuilder.aspx

I am 1/3 of the way through the tutorial and I like ASP.Net thus far.

Populating ComboBox From Dataset

Hi Guys,

I need to populate a combobox from a dataset returned from a webservice. I set the datasource property of the control to the web method but got an empty list at run time! What am I doing wrong? Any help on how to achieve this? Looping through a datareader solved the problem but I want to consume a dataset from a web service. I thought this would be a straight stuff but I'm having problems with it.After setting the datasource property you have to bind the data to your controll.

It seems you are missing that bit.
I can handle that with DropDownList control in ASP.Net but not with ComboBox in Windows Application! Could you kindly show how syntactically?
Are you getting an error?
What does it say?

Post your code so that we can see more clearly what has gone wrong
I am not getting any error message! I only get this wierd entry in the ComboBox. "System.Data.DataViewManagerListItemTypeDescriptor"

This is the code that I used.

Private Sub Users_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wsDemo As New ng_app001_pc_stock.PCInventory
ComboBox1.datasource = wsDemo.getAllOSTypes
End Sub

The webmethod getAllOSTypes works well, at least I tested it with DataGrid control. What could be wrong?

Populating DataList control

I have a datalist control on a web page and I am trying
to populate it through the page_load event.
The name of the control on the web page is "MyList".
I had code behind a button click to populate it and that
worked. Now that I've moved the code to the page_load
event it is not working. I suspect that "MyList" on the
page doesn't know about "MyList" in the page_load code
but I don't know how to connect the two. Any help would
be appreciated.
Here is the code
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim MyList As DataList
MyConnection = New SqlConnection
(" server=x2;database=Orders;Trusted_Connec
tion=yes")
MyCommand = New SqlDataAdapter("select
ReferenceNO, Loc from Request", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Request")
MyList = New DataList
MyList.DataSource = DS.Tables
("Request").DefaultView
MyList.DataBind()
.Hi, Jerry
From your code, I guess you are dynamically generating datalist.
However, I don't see any code to add the datalist to the page.
You need to add:
Page.Controls.Add(MyList)
Bin Song, MCP
Hi Bin,
I had added the DataList control from the toolbox. My
problem was that I had failed to add the
<%# DataBinder.Eval(Container.DataItem, "ReferenceNO") %>
inside the <td> tags in the control.
Thanks,
Jerry

>--Original Message--
>Hi, Jerry
>From your code, I guess you are dynamically generating
datalist.
>However, I don't see any code to add the datalist to the
page.
>You need to add:
>Page.Controls.Add(MyList)
>Bin Song, MCP
>.
>
So your problem solved or not?
Yes. Problem solved. Thanks.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Populating DataList control

I have a datalist control on a web page and I am trying
to populate it through the page_load event.

The name of the control on the web page is "MyList".

I had code behind a button click to populate it and that
worked. Now that I've moved the code to the page_load
event it is not working. I suspect that "MyList" on the
page doesn't know about "MyList" in the page_load code
but I don't know how to connect the two. Any help would
be appreciated.

Here is the code

Dim DS As DataSet
Dim MyConnection As SqlConnection

Dim MyCommand As SqlDataAdapter
Dim MyList As DataList

MyConnection = New SqlConnection
("server=x2;database=Orders;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select
ReferenceNO, Loc from Request", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Request")

MyList = New DataList
MyList.DataSource = DS.Tables
("Request").DefaultView

MyList.DataBind()
..Hi Bin,

I had added the DataList control from the toolbox. My
problem was that I had failed to add the

<%# DataBinder.Eval(Container.DataItem, "ReferenceNO") %
inside the <td> tags in the control.

Thanks,

Jerry

>--Original Message--
>Hi, Jerry
>From your code, I guess you are dynamically generating
datalist.
>However, I don't see any code to add the datalist to the
page.
>You need to add:
>Page.Controls.Add(MyList)
>Bin Song, MCP
>.
So your problem solved or not?
Yes. Problem solved. Thanks.

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