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


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

How can i return a value from a simple WebForm.aspx to javascript code.

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net
 

Hi Experts.

How can solve this problem; Suppose you write a simple JavaScript code in form tag like this:

<script  language="javascript">

                Var type="100";

                Var result = ';

Var iframe = '<iframe src="WebForm1.aspx?"t=' + type + '"></iframe>';

Document.write(iframe);           // call WebForm1.aspx in iframe tag

Document.write(result);            //write the result that return from WebForm1.aspx

</script>

I want return the value from WebForm1.aspx and save it in result variable. How can I do?How can i return a value from WebForm1.aspx and save it in result variable?

With Regards.Mojtaba




View Complete Post


More Related Resource Links

Simple Captcha Code in Javascript

  
The article Simple Captcha Code in Javascript was added by miya2008 on Tuesday, June 29, 2010.

Here I create a Cptcha Code With JavaScriptStep 1:->In the (.aspx) page we write the following Code:->%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>!DOCTYPE

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Code works on aspx but not ascx

  

Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.


I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday
        recordEntry.InsertRecord()



Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

XMLHTTP.ResponseText return unexecuted code?

  

I have a simple asp with the following code.  When I access this page directly (via browser) everything works fine:  the xml object shows up fine.  When I call this page via VBA (excel), the ResponseText method of the 

XMLHTTP object returns the below code unexecuted.  Anybody knows what's going on?  thanks.





<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <% Response.Buffer = True Response.ContentType = "text/xml" Dim oDataXML As Object 'Custom Data XML passed in by caller. On Error Resume Next 'Load the XML passed into the request. oDataXML = Server.CreateObject("Microsoft.XMLDOM") oDataXML.Load(Request) Dim sResult As String sResult = "<?xml version=""1.0""?>" sResult = sResult & "<OrderProcessed>" sResult = sResult & "<Status>test</Status>" sResult = sResult & "<OrderID>111</OrderID>" sResult = sResult & "</OrderProcessed>" Response.Write(sResult) Response.End() %>



Wicked Code: Silverlight Page Turning Made Simple

  

As we'll show, with just a few lines of JavaScript you can build a general-purpose framework for incorporating page turns into Silverlight 1.0 apps.

Jeff Prosise

MSDN Magazine May 2008


Secure Habits: 8 Simple Rules For Developing More Secure Code

  

Never trust data, model threats against your code, and other good advice from a security expert.

Michael Howard

MSDN Magazine November 2006


Return of the Rich Client: Code Access Security and Distribution Features in .NET Enhance Client-Sid

  

Rich clients employ many of the features and conveniences of the operating system they run on, and the list of these features has been growing since the dawn of the PC. But as apps have migrated to the Web, the trend towards increasing client-side functionality has ground to a virtual halt. There are several reasons for this; chief among them are security and deployment problems. But that's all about to change. With the .NET Framework, you can participate in building the distributable rich client of the future. In this article, the author enumerates the pertinent features of .NET that will allow you to build safe, easily deployable controls. The features discussed include managed code, code access security, versioning control, Windows Forms classes, and isolation.

Jason Clark

MSDN Magazine June 2002


>>>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;">


What's the problem in my javascript's code to get ClientID Property?

  

 

 Hi all.

I wirte a simple java script code to get ClientID of controls on the webform. The code is like:

<script type="text/javascript" language="javascript">

var butt = $find("<%= Button1.ClientID %>");

alert(butt);

 <script>

But when i run it , i have a problem. The probmel is:

 

Server Error in '/' Application.

The Controls collection cannot be modified because t

javascript in code behind

  

Hi all,

i want to write javascript for lightbox effect

for that i am usingthe following code but it is giving javascript error.

Response.Write("<Script Language=JavaScript>window.open('frmPreviewQuestionnaire.aspx?qName=" + name + "','Form','location=no,scrollbars=yes,resizable=no,status=no,fullscreen=no,left=250px,top=150px,width=450px,height=300px');</script>");


can anybody help me plz..



Browser window is opening up on the second click with javascript code

  

Hi,

I am trying to set a javascript code to open up a new browser window with this URL that exists like shown below.

On the first click nothing happens but on the second click the browser window is opening up.

 

How is it possible to make it open up on the first click ?

                                <asp:ImageButton ID="ImageButton3" runat="server" Height="84px" 
                                    ImageUrl="~/images/1.jpg" Width="165px" 
                                    onclick="ImageButton3_Click" />

    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
    {
        String openURL = "javascript:window.open('" + "Folder1/testing.aspx" + "');return false;";
        ImageButton3.OnClientClick = openURL;
    }


 


Call Server Side Code from Javascript in VB.NET

  

Hi

Could anyone give me an example how to call Server Side Function from javascript and then I want to call that javascript function on Button OnClick () Event.


Thanks in Advance

Shabbir



Infopath form return XMl code during workflow task

  

1.     Review 7777.xml.

2.     Perform the specific activities required for this task.

Use the Edit this task button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click here to request access.

What is this Mysterious Javascript code in my asp.net website doing???

  

I have an asp.net website(using Visual studio 2008), when i debug the site on my development machine, it loads well with out any errors. At this point i leave the site running in debug mode but i notice strange things. 


0). When i right click the file and check the properties, it has a URL property whose value is http://cdn1.predictad.com/scripts/publishers/suggestmeyes/predictadme.js?si=7495


1). In my sites Solution Explorer, there appears a folder called "Windows Internet Explorer". Under this folder, there is a file called predictadme.js?si=7495. When i open that file, it contains the code below. (Apologies, i failed to format the code, only saw options for C#, C++, CSS, VB, XML/HTML, Razor, SQL when  trying to insert code and i think the code below is non of these)


I dont have idea where this code is coming from, but the presence of the string .facebook. makes me suspicious. I have a feeling some thing fishy is happening but am really not any where near good at javascript (scripts), so am seeking

Help: Too many lines of code to achieve a simple goal: keep my NULL SQL values...

  

Hello all

Question:
--------------
What is the best way (best practice) to preserve my NULL SQL values in the database
during an insert/update operation (without receiving cast invalid errors)?
Also, how to display a string 'n/a' when a sql value is NULL?

Description:
----------------
My project is using FormView with Edit/Insert templates and classes to represent my tables

Goals:
------------
Goal1....: display 'n/a' when there are NULL SQL values in the database
Solution1: I am using ISNULL(field,'') in my store procedure for SELECT statements

Goal2....: if the fields are 'n/a', then save them back in the database as NULL
Solution2: on my insert/edit methods I am having to check the values being passed, i.e:

cmd.Parameters.Add(new SqlParameter("@scope", SqlDbType.NVarChar, 50));

if (item.Scope == "n/a")
 cmd.Parameters["@scope"].Value = DBNull.Value;
else
 cmd.Parameters["@scope"].Value = item.Scope;


Not to mention that for SQL DateType fields when you use ISNULL(field,'') the return string is '1/1/1900 12:00:00 AM'
and I have to change the field value in every field that represents a date, i.e:

protected void FormView1_DataBound(object sender, Sy

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