.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Capture query string value in javascript in aspx page

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net
 

I have a simple problem that I cannot remember how to solve.  I am sure it is very easy.  Following is my code:

<asp:Image id="btnAddNew" runat="server" ImageUrl="~/images/btnAdd.png" OnClick="javascript:window.open('DetailLocation.aspx?projectID=&locationID=','newWindow','width=600,height=600,scrollbars=yes');" />

In the OnClick event I have embeded a javascript function that works as expected. However, I need to embed a querystring value into the javascript function variable:

DetailLocation.aspx?projectID=??

I thought I could just embed <%=Request("projectID") %> in there, but the compiler does not like it. 

Thanks in Advance.

 


 




View Complete Post


More Related Resource Links

How to filter managed meta data column using page query string?

  
I have two managed term sets as follows: Articles:Downloads Projects:Downloads I am trying to use a content query web part to filter a list based on the above manged meta data column. I want to filter out only "Articles:Downloads" Scenario 1: When I edit the web part and directly set the filter option with the managed meta data column to "Articles:Downloads" it works fine. When I export the web part, in the .webpart file, the "FilterValue1" property has a value "Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910". Scenario 2: I want the web part to get the filter information from query string [PageQueryString:pageType]. So I tried using these options: a) pageType=Downloads      This works but returns downloads under 'projects' as well. (i want downloads only under 'articles')  b) pageType=Articles:Downloads     Does not work and shows no records c) pageType = Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. (This value is the same as one found in 'FilterValue1' of the static web part). c) pageType = Articles:Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. d) pageType = 9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work.   What am I missing here? Can some one please help?

select query for linq on Default.aspx.cs page

  

how do i create linq query and asign that query to as data source to datalist on default.aspx.cs page


How to access child(.ascx) page control from parent page(.aspx) javascript

  

I have functionality to select All check boxes on grid rows.

Child User control is having grid with checkbox to select all rows of grid. I want to select individual cell html from each row when I select all rows when checkbox 'select all' is clicked and place it into textbox which is in Parent page.

This textbox can only be in parent page.

So i need to call child(.ascx) page control from parent page(.aspx) using javascript as follows.

function CheckUncheckChildren(event)
    {
        document
        debugger;
        var childChkBoxes = document.getElementById('<%=gvUserDetails.ClientID %>').getElementsByTagName("input");
        var childChkBoxCount = childChkBoxes.length;
        var evtelem = (isIE())?event.srcElement:event.currentTarget;
        if(evtelem.checked == true)
        {
            for(var i = 0; i<childChkBoxCount; i++)
            {   
    &nbs

Load Previous ASPX Page while click on Javascript History.Back

  

Hi All,

I am stuck with a unusual Scenario, I have Default.aspx page which contains a Search criteria option and Gridview, After doing particular search result is displayed in Gridview .

When i click on selectedindexchanged event of Gridview it takes me to another page called Details.aspx where there is form in edit mode where the user can update and save the data into a database . In Details.aspx page i have link button which have history.back function which takes me to default.aspx page where i can retain my Search criteria and Gridview Result but my query is when click on Link button i want to call any of the Events of Default.aspx page.


Thanks in Advance

Shabbir




Server Side Javascript in ASPX page

  

Hi,

We have a Classic ASP application. We need to migrate this Classic ASP application to ASP.net.

We have extensevly used Server side Javascript in our Classic ASP Pages.

Basically we have mix of both VBScript and Javascript in same ASP pages.

Need help in migrating such ASP pages (using serverside VBScript and Javascript).

Migrated Code samples will be most welcome.

For migration,  we are planning to use : ASP to ASP.NET Migration Assistant

Example below -

  • Sample.htm : These kind of HTML pages are hitting ASP pages to get response from server.
  •  

    <html> 
    <head> 
    <script> 
    var strURL = "http://localhost/Samples/"; 
     
    function test0(methodType){ 
     
            var oRequest = new ActiveXObject("Msxml2.XMLHTTP"); 
            var url = strURL + "Sample.asp";  
             
            oRequest.open(methodType,url,false);  
            oRequest.send(null);  
     
            var resp = oRequest.responseText; 
             
            alert(resp); 
    } 
     
    </script> 
     
    </head> 
    <body> 
    <input type=button onClick="test0('GET')" value="Click me - Get Method"/> 
    <br><br> 
    </body> 
    </html>
    • Sample.asp : This is sample ASP page where we are using both servreside VBScript

    Server Side Javascript in ASPX page

      

    Hi,

    We have a Classic ASP application. We need to migrate this Classic ASP application to ASP.net.

    We have extensevly used Server side Javascript in our Classic ASP Pages.

    Basically we have mix of both VBScript and Javascript in same ASP pages.

    Need help in migrating such ASP pages (using serverside VBScript and Javascript).

    Migrated Code samples will be most welcome.

    For migration,  we are planning to use : ASP to ASP.NET Migration Assistant

    Example below -

    • Sample.htm : These kind of HTML pages are hitting ASP pages to get response from server.

     

    <html>
    <head>
    <script>
    var strURL = "http://localhost/Samples/";
    
    function test0(methodType){
    
    	var oRequest = new ActiveXObject("Msxml2.XMLHTTP");
    	var url = strURL + "Sample.asp"; 
    	
    	oRequest.open(methodType,url,false); 
    	oRequest.send(null); 
    
    	var resp = oRequest.responseText;
    	
    	alert(resp);
    }
    
    </script>
    
    </head>
    <body>
    <input type=button onClick="test0('GET')" value="Click me - Get Method"/>
    <br><br>
    </body>
    </html>
    • Sample.asp : This is sample ASP page where we are using both servreside VBScript and Javascript.

     

    &

    How to Encrypt Query String Parameters in ASP.NET

      
    Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

    Launch CMD File From ASPX Page

      

    My organization uses a CMD file to install updated files for a major enterprise application. Currently, we send out an email to users with a link to the file and instructions to run it, BUT inevitably users don't update their machines until their in field and try to start the app.

     

    We're now liking the idea of using an ASPX page to prompt the users to run the updates and to capture the fact that the updates have been run. I realize that we can't capture the success or failure of the update. But we'd like to capture the user accessed the page.

     

    Is it possible to embed into the markup for the page a link to the file on the local intranet that the users can click on to run the file?

    The user accessing the page would capture that they did just that. We'd deal with wether or not the update was actually installed or if it failed later with them directly.


    Re-positioning an HTML container with javascript onresize with a Master page.

      

    I have an HTML <div> container that I float to the right of a gridview.  When the browser window is maximized, it looks fine.  When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.

    If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.

    What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.

    I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page.  I think I'm having a very "thick" week...

    - Tinker

     


    Content page control passes as argument to javascript function

      

    Here is the content page:

    ********************************************************************

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <script type="text/javascript" >
     function copyValue(input, output )
    {
       ouput.value = input.value;
       return true;
    }
     </script>
     <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="txt2" runat="server"></asp:TextBox>
    </asp:Content>

    ********************************************************************

    I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

    <input name="ctl00$ContentPlaceHol

    Visual Studio closes itself by opening aspx-Page designer after Windows Update

      

    Hey Guys,

    I've a problem with my Visual Studio.

    On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.


    Thanks

    Nik


    How to send an email with information in query string

      

    First I will say I googled (Binged to make Bill happy) for this but could not find anything, perhaps I am not stating what I need correctly;

    I have a website that a customer creates orders (for a printing company) and after the order, I would like to email the customer a link to view the status of their order;

    I need to send the CustomerID in the link so on the returning page if a CustomerID is detected in the querystring, I "auto login" the client and open the "Dashboard" for the order page for that customer.

    Can anyone point me in the right direction as to how to send the link and how to parse the querystring to get the values from the link;

    Thank you if you can point me in the right direction.


    Integrating aspx page in classic asp web application

      

    Hi,

    I have a classic asp web  application. I am trying to add an aspx(C#) page to the existing asp application.

    The existing asp pages have include pages for header and footer. How to add the classic asp include files in aspx page.

    Also, How to deploy the aspx page in the existing classic asp web application.

    Thank you


    ASP.NET Proxy Page - Used for Cross Domain Requests from AJAX and JavaScript

      
    The article ASP.NET Proxy Page - Used for Cross Domain Requests from AJAX and JavaScript was added by Aamir Hasan on Thursday, August 19, 2010.

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn't allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull content

    >>>How to use javascript function in aspx file?

      

    Hi,

    I have a file util.js and there some funtions in same file.

    For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

    I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

    Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

    Anyone have idea. Do share with me.

    I used the reference like this:

    Javascripts/util.js

    ' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">


    Getting URL without Query String

      
    Is there an easy way to get the URL portion without the query string of a given URL?

    E.g. http://www.abc.com/?a=b&c=d --> http://www.abc.com/

    Flash player doesn't send cookies while requesting an aspx page

      

    Hi.

     I'm developing a web-site, that uses SWFUpload for multiple files upload to the server. Page, that uploades files, is accessable only to registered user. Authentication is done via web-forms (authentication mode="Forms" in Web.config). Flash uploades files to special web page - upload.aspx. In IE everything works great, but Flash player in non-IE browser (in Firefox, for example) does not send any cookies to upload.aspx. Because of it no sesion and no authentication information is available in this page.

     I can pass all the information, necessary for uploading, in GET-parameters, which upload.aspx recieve. But this is a serious security hole and I don't want to expose session information. I can pass session identifier in GET-request. But the question is the following: how can I restore session information from the session identifier? How can I make HttpContext.Current.User point to currently logged in user in this case?

    Any help will be appreciated.
    Categories: 
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend