Passing Parameters To OnLoad In Aspx Page From Javascript?

Aug 11, 2010

I have this javascript

function myFunction(source) {
window.open(source, "Title", 'width=400, height=400');
}

and in c# code I call it by

HtmlPage.Window.Invoke("myFunction", source);

which opens up a aspx page and goes to its OnLoad function:

protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);

how do I pass in parameters to the event args in the aspx page? or is that even possible? and how can I pass these parameters from my c# code to the javascript?

View 2 Replies


Similar Messages:

Javascript - Resize IFRAME Onload In .aspx Page

Feb 8, 2011

In an .aspx page with the vb.net codebehind i am using IFRAME , which would be created inside the repeater control. Since i want to resize the IFRAME based on the content within the page i have been using the resize function Obtained from here on the IFRAME onload as shown below.

<iframe id="IframeSubsectionArea" scrolling="auto" width="100%" onload="resizeIframeToFitContent(this)" runat="server">

However it is throwing the error as the method could not be found in the form. Is there any client side script variant for the onload event? May i know,What might be the reason for the error and its solution?

View 1 Replies

Dynamically Passing Parameters From ASPX Host

Aug 5, 2010

I am looking for someone to provide guidance as to whether the following solution is the prescribed way of going about this. Yesterday I started working on a problem that, at first blush, seemed pretty simple and straightforward. I need to pass a few parameters from an ASPX code-behind, which hosts a Silverlight object tag, to the code-behind of one, or more, of the Silverlight user controls within the hosted Silverlight application. So, after doing some research, this is the basic solution I developed.

I found out that an attribute can be added to the object tag called initParams, a comma delimited list of parameter names and values can be added to this attribute. Like so.

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SampleApplication.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" />
<param name="autoUpgrade" value="true" />
<param name="initParams" value='DealerId=17' />
</object>

This is fine, except that the DealerId parameter is basically hard-coded in the object tag, not real useful. The next thing that I did was replace this object tag with a literal control, and set the text of the literal control within the page's code-behind to the value of a StringBuilder (where I built up the full object tag along with dynamically adding the correct DealerId value). In the following example, the DealerId is hard-coded, but you get the idea.

var sb = new StringBuilder();
sb.Append(@"<object data=""data:application/x-silverlight-2,"" type=""application/x-silverlight-2"" width=""90%"" height=""80%"">");
sb.Append(@"<param name=""source"" value=""ClientBin/Ascend.SilverlightViewer.xap""/>");
sb.Append(@"<param name=""onError"" value=""onSilverlightError"" />");
sb.Append(@"<param name=""background"" value=""white"" />");
sb.Append(@"<param name=""minRuntimeVersion"" value=""3.0.40624.0"" />");
sb.Append(@"<param name=""autoUpgrade"" value=""true"" />");
sb.Append(@"<param name=""initParams"" value='");
sb.Append(@"ServiceUrl=");
sb.AppendFormat("http://{0}{1}", Request.Url.Authority, ResolveUrl("~/ReportService.svc"));
sb.Append(@",DebugMode=Full");
sb.AppendFormat(@",DealerId={0}' />", 40);
sb.Append(@"</object>");
litObjectTag.Text = sb.ToString();

My goal, if this initial design is sane, is to then pull this object tag creation into a server control, which will have a DealerId property, which in turn will be set within the hosts code-behind. At this point, I have the host dynamically adding parameter values to the object tag's initParams attribute, the next step is to get these values and leverage them within the hosted Silverlight application. I found a few articles to help out with this; I'm creating a public dictionary within the App.xaml.cs, and setting it within the Application_Startup event.

public IDictionary<string, string> InitConfigDictionary;
private void Application_Startup(object sender, StartupEventArgs e)
{
InitConfigDictionary = e.InitParams;
this.RootVisual = new MainPage();
}

Now, I can access this public dictionary from the code-behind of any .xaml user control, like this.

App app = (App)Application.Current;
var dealerId = app.InitConfigDictionary["DealerId"];

This design works just fine, I'm just looking for some guidance, since I'm new to Silverlight. Once again, the implementation works, but it seems like a whole lot of work to go through just to pass a dynamic value from the host to the .xaml files. Because I'm new to Silverlight, I'm hoping that someone with more experience can say that either:

a) Patrick, you're insane, why are you going through all this work when clearly in Silverlight you would accomplish this through the use of "xxxxxx".
b) Yeah, Patrick, it's a drag, but this design is basically what you have to do in Silverlight.

View 1 Replies

Run Javascript Onload Of Content Page

Mar 3, 2010

On a regular page I can do a:<body onload="SomeScript();">

How do I do the same when using Master Pages and there is no Body?

View 3 Replies

How To Run The Javascript Function On The Page Onload Event In Content Page Of Master Page

Nov 4, 2010

HOW TO RUN THE JAVASCRIPT FUNCTION ON PAGE ONLOAD EVENT IN CONTENT PAGE OF MASTER PAGE.?

means i have masterpage and the content page of master page namely default.aspx in vb.net

My problem was that .

i wanna run javascript function in Default.aspx and i have called the function

body onload in master page..

when i run my website it shows the error

"" Microsoft JScript Runtime Error : Object Expected ""

View 4 Replies

Javascript - Passing Parameters To Popup Window ?

Nov 2, 2010

I am trying to pass parameters to a popup window via query string(a hidden field id & a textbox id). However, since I am using master pages the id's are very long (ct100_someid). Is there a way to elegantly pass my ids ? Can I shorten my id's or not show them to the user at all?

View 2 Replies

Web Forms :: Passing Parameters From A Datalist To Another Page?

Jun 11, 2010

passing parameters from a datalist to another page.

this is how my app works:

i have a database ( access) a table with the following columns: id,title,desc,photo.

another table with the following columns: (startsin, endsin,price,tId)

on the first page (tourpack.aspx) i have a datalist, when user clicks on a button that is in the templateitem of the datalist, he will be transfered to another page called (showtour.aspx). what im trying to do is passing the ID parameter from the first page (table 1) to the second page (showtour.aspx) with the id number so he can see the specific details of that "tour" that are located In the second table.

View 8 Replies

SQL Server :: Passing Parameters For Select Query To Another Page

Dec 14, 2010

I have an asp.net site which includes a "search" page that queries an SQL table, then redirects the user to a "results" page where the results of the query are displayed. The parameters for the query are assembled into a string which is the SELECT statement. I've been asked to add additional functionality that requires a secondary search which takes place on the "results" page. How can I pass the parameters from the "search" page to the "results" page so that I can access those parameters in the code behind? Here's the first page code behind (I inherited most of this from another developer):

[Code]....

And the second page--it would be on line 51 that I would need to insert the parameters from the search above:

[Code]....

View 3 Replies

SQL Reporting :: Passing Parameters To SSRS Report From Web Page?

Sep 2, 2010

I have a web page that displays some data. When they click a submit button, I want to run a report. But I would like to pass the start year/month and end year/month values that the user already entered on the web page to the report. Here is what my url looks like when the report is displayed:

http://xyzserver/Reports/Pages/Report.aspx?ItemPath=%2fReports%2fDevicesAllNew&rs:Command=Render&StartYYMM=201007&EndYYMM=201008

But my report displays the 2 textboxes for my StartYYMM and EndYYMM parameters as empty. What am I doing wrong? I did a google search and I saw something about using ReportServer instead of ReportManager. I notice at the top of the browser when I run my report, it reads "Report Manager - Windows Internet Explorer". Is this correct?

View 3 Replies

Passing Dynamic Parameters To A Mysql Query From Page?

May 20, 2010

I've a requirement that I need to read an excel sheet programmatically using asp.net/C# and write the data obtained into a mysql table.The excel sheet contains something around 50 columns and 2000 records.I am able to read the data from the excel sheet and store it in a dataset.I am using the following code to write the data into mysql table.

for (int i = 1; i <= myDataSet1.Tables[0].Rows.Count - 1; i++)
{
MySqlCommand cmd = new MySqlCommand();
for (int j = 0; j <= myDataSet1.Tables[0].Columns.Count - 1; j++)
{
paramset[j] = myDataSet1.Tables[0].Rows[i][j].ToString();
cmd.Parameters.AddWithValue("val" + j, paramset[j]);
}
cmd.CommandText = "Insert into faqimport
cmd.Connection=con;
cmd.CommandType = CommandType.Text;
int x=cmd.ExecuteNonQuery;
}

When I try to run the above code I am getting 'Unknown column 'val0' in 'field list'' error.I understand that i am manually creating the parameters val0,val1,val2.....instead I am creating them dynamically using the integer 'j'.But I do not want to create around 50 parameters to insert data into the database table.

Also is there a way i can get the column datatypes from the excel sheet in order to create a new table in mysql with the columns in the excel sheet?

View 1 Replies

Passing Value To Another Page Using Https / Cannot Read The Control Values From Default.aspx Page

May 30, 2010

I need to force SSL when going to the final checkout page (for example from default.aspx to checkout.aspx).

I need to pass variables to this check out page and tried to use server.transfer(https://www.mydomain.com/checkout.aspx). I then use previous page .Fincontrol to read text box and label name to this check out page. If I only do the server.transfer("~/checkout.aspx") then my I can read all vakues of my controls from the passing default.aspx page.

But when I force https:// then I cannot read the control values from default.aspx page.

Please give me some tips on how to get control values to the https:// destination page or if you have another tips on how to do it the right way, please let me know.

View 8 Replies

Web Forms :: Passing Text Box Value From Aspx.cs Page To SelectParameters In Page

Sep 5, 2010

I would like to take a value from a text box and pass it as a search parameter to my database. I get the value from my code behind page as follows: protected void btn_click(Object sender, ImageClickEventArgs e)

View 2 Replies

Override The OnLoad Of The Class That The .aspx Is Directly Inheriting From?

Jan 19, 2010

If I'm writing in-line code on a .aspx page is it possible to override the onLoad of the class that the .aspx is directly inheriting from? Right now if I do the override the base.onLoad inline on the .aspx page it is overriding the "Page" object's onLoad event not the class the .aspx is inheriting from.

View 1 Replies

Web Forms :: Passing Value To Another Aspx Page?

Jun 15, 2010

I am trying to pass a value from one aspx page to another using test2.aspx?Tag=blah.

When I try to pass Request.QueryString["Tag"] to a webusercontrol on test2.aspx it tells me that Request.QueryString["Tag"] is null or empty.

I am doing this in the page load. Should I be doing it somewhere else ?

View 21 Replies

PageLoad Event Is Not Fired When An Aspx Is Opened Through Javascript Of Another Aspx Page

Jan 25, 2011

I have an aspx application with 2 aspx pages. Second aspx page will get opened on click of a button in first aspx page using JavaScript. The problem is, when the second aspx page is getting opened, its Page_load event is not firing. Only when I refresh the second page, page_load event of second aspx page is fired. what might be the problem and what is to be done to fire the page_load event.

View 1 Replies

Passing Data Source Value To ASPX Page

Apr 17, 2016

I am new to VB.net programming and working on a school assignment. I have 2 display pages: default.aspx and DisplayTaxReturn.aspx. On default.aspx I have a list view where it uses data source to get the tax payer ID's from the server and I also have a details view where it displays the records associated to the tax payer.

When I click the View button on default.aspx it takes me to DisplayTaxReturn.aspx where it should display the tax payer ID and it's records that were displayed in default.aspx using label text fields.

My question is, how do I pass the values of the selected tax payer ID (datasource1 on default.aspx) to the DisplayTaxReturn.aspx page?

View 3 Replies

Get Parameters Out Of An Ascx Back To Main Aspx Page?

Jun 15, 2010

I've got an aspx page that renders an ascx page with filtering capabilities. Inside the ascx page, parameters are passed as follows:

<tr>
<td class="label">Plataforma</td>
<td class="field lookup"><%= Html.Lookup("s.Site", null, Url, "Sites") %></td>
</tr>
<tr>
<td class="label">Data</td>
<td class="field date"><%= Html.TextBox("s.Date", DateTime.Today.ToString("yyyy-MM-dd")) %></td>
</tr>

I need to be able to get those parameters on the main aspx page, because they are needed for an action that is called there. How could I access these parameters?

View 1 Replies

Javascript To Run After OnLoad But Before Anything Else To Set Defaults

Sep 7, 2010

So I have an .aspx page loading up and populating drop downs based on a lookup table in the database. What we want is for the user to be able to configure which of these values comes defaulted by specifying that value in a drop down somewhere else in the app. Now, it's easy to default the "first" value, or something like that, but we want this to act differently. Is there a JavaScript function that can run immediately after onLoad (so the drop downs are populated already), that can go through the drop down and make one of those default so it looks like the page is loading with that set as default and people don't realize the workaround? (weird masking, etc.) I'm not TOO experienced with JavaScript so something like this may already exist. Here is an example of how we add the dropdown control to the page, in case you guys even need that.

With CType(.AddControl(New Controls.ComboBox("CodeId", "../../../../CodeId", "Code")), Controls.ComboBox)
.ForceSelection = True
.ValueField = "LookupID"
.DisplayField = "LookupDesc"
.Validate.AllowBlank = False
.ForceSelection = True
.ReadOnly = EditControl.IsFieldReadOnly(10580)
.BindData(Model.Codes)
End With

View 2 Replies

Timing Of Page_load And Javascript Onload

Dec 19, 2010

I have the following call in my master page

[Code]....

So, in the above on the Master Page onload I am calling the javascript to get the screen resolution Then in my default page....which is being used first. My master page is loading and then my default page is loading. I have this is my Page Load event

[Code]....

However, what is happening is that I am getting the MessageBox.Show from the default page saying the screen is <null> by <null> and then I start getting the alert boxes from the javascript saying what the screen width and screen height is. In my page Load event of default. how can I wait until the java script in Master is done? Or is the a better place to put these events?

View 6 Replies

Web Forms :: Passing Values Between Aspx Pages(Master Page)

Dec 28, 2010

I've a form containing 30+ textboxes. I'd like to save the data entered in the form texboxes in an object(session) and pass them into another page and simply display the values in a tabular form. How can i do that. Also, suggest me the best way to do it.

View 7 Replies

Web Forms :: Passing Control Parameter Values From One Aspx Page To A Second

Apr 7, 2010

I have a web form that has drop down controls. These controls are data bound to a database. Now, I would like the results of the selected values to be shown on a new aspx page in a gridview or detailsview.

View 3 Replies

Web Forms :: Passing Query String Between 2 Frames In An Aspx Page?

Aug 13, 2010

I'm having an aspx page with 2 frames, one is the header and the the other one is content frame which i'm trying to load it dynamically. Everything is fine. Let me explain my scenario

On the header frame i'm having 5 link buttons and when a link button is clicked i'm passing a hardcoded Page URL to the frames containing page and then trying to load that page in the content frame.

Below is my code, Everything as far as i know are in right place, but i cannot see the page in content frame..

Header.aspx.cs

[Code]....

Then checking frameURL querystring in default.aspx page load:

[Code]....

when the querystring is null, the SiteSummary.aspx page is getting loaded in content frame without any issue, but when there is a querystring value the page is not being loaded.
Here is my Default.aspx page

[Code]....

View 5 Replies

Call Javascript Function On Label OnLoad

Aug 25, 2010

I want to call javascript function on label onload, reason I am using an enitity Datasource and assignng a value to this label, but I want to hide it if the value is empty.

View 3 Replies

C# - Javascript Event Like Window.onload For Subsequent Loads?

Feb 9, 2011

We have a function that changes the iframe height at the window.onload event so we can adjust it to the page contents. The problem is that after clicking in an asp:menu the height its restored to its default and the window.onload event doesnt fire...so we need the event that would fire in subsequent loads (tried window.unload but didnt trigger)

The resize function cant be called on the asp:menu click because the window wouldnt have finished loading so the height calculation would fail...

View 4 Replies

Forms Data Controls :: Tie DataSource To SqlDataSource On Aspx Page And Pass Select Parameters?

Nov 10, 2010

[code]....

Is ther a way I can tie DataSource to SqlDataSource on aspx page and pass select parameters?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved