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


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

How to return a string value to code behind?

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :.NET Framework
 
How to get a string value from a stored procedure to the code behind of ASP.net with C#


View Complete Post


More Related Resource Links

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() %>



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


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.

Encoding.ASCII.GetString(bytes) return string with not expected

  
Example   byte[] bytes = {  0x36,0x92,0x30,0x94}; string rs=  Encoding.ASCII.GetString(bytes) ; //result rs = ?60?   Is Wrong Result; Result Right is     '60". So this function should fix to properly decode two symbols ' and " Code ASCII ' is 0x92,Code ACII for " is  0x94

How to return back back to code behind file after cascading dropdown calling

  
Hi, I have a cascading dropdown. After the dropdown is populated(it is in another file)  i would like to return back to the original form where the control is placed. is there anyway of doing it

ocienvcreate failed with return code -1

  
Hi. Its problem is generated in a Windows 2000 server and vb.net application. The users connect to aplication by terminal server. This is a permission problem... Thanks....DFPP

Writing connection string in web.config file by code or dynamically

  
I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

HtmlHelperExtensions in MVC2 return a HTML string, unencoded. In MVC3 this tring is encoded!

  
 HtmlHelperExtensions in MVC2 return a HTML string, unencoded. In MVC3 this string is encoded! How can I return unencoded HTML to a Razor view in MVC3? 

Install return code for product 'SQL Server Express 2008 R2' is Failure

  
I have winXP sp3. When i tried to install SQL Sever 2008 R2 through Web patform installer I got this error: DownloadManager Information: 0 : Loading product xml from 'https://go.microsoft.com/fwlink/?LinkId=193533' DownloadManager Information: 0 : Product manager downloading: https://go.microsoft.com/fwlink/?LinkId=193533 DownloadManager Information: 0 : Remote file has not changed, using local cached file:C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\-231145492.xml.temp DownloadManager Information: 0 : Loading product xml from 'https://www.microsoft.com/web/webpi/2.0/WebApplicationList.xml' DownloadManager Information: 0 : Product manager downloading: https://www.microsoft.com/web/webpi/2.0/WebApplicationList.xml DownloadManager Information: 0 : Remote file has not changed, using local cached file:C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Web Platform Installer\-1221301405.xml.temp DownloadManager Information: 0 : Filtering by majorOS: 5, minorOS: 1, majorSP: 3, minorSP: 0, productType: 1, architecture: x86 DownloadManager Information: 0 : Filtering by majorOS: 5, minorOS: 1, majorSP: 3, minorSP: 0, productType: 1, architecture: x86 DownloadManager Information: 0 : Adding product SQL Server Express 2008 R2 (SQLExpress) to cart DownloadManager Information: 0 : Product 'SQLE

how to insert Value from C # code To SQL string?

  

Hi.

I have connection string to sql and text Value wich I get from combobox no I wont to insert this Value to connection string how I do that correctly?

there is a code.

var value1 = CorporationCode1.Text;              

                DataSet ds2 = new DataSet();

                SqlConnection con2 = new SqlConnection("Data Source=DAN-PC;Initial Catalog=DMS_VEOLIA;Integrated Security=True");

how to insert Value from C # code To SQL string?

  

Hi.

I have connection string to sql and text Value wich I get from combobox no I wont to insert this Value to connection string how I do that correctly?

there is a code.

var value1 = CorporationCode1.Text;              

                DataSet ds2 = new DataSet();

                SqlConnection con2 = new SqlConnection("Data Source=DAN-PC;Initial Catalog=DMS_VEOLIA;Integrated Security=True");

Getting VP.NET code to respond to SQL Return values and Error Codes

  

I have SQL stored procedures that will return values depending on the outcome of its execution. I have the following code at the end of each of my Stored Procedures:

RETURN @siReturnValue

It would be great to be able to use this Return value after running the Stored Procedures from my VB.NET code. I have included an example of how I am running SQL Stored Procedures below:

    Public Function SearchKeyword(ByVal SearchString As String) As Data.DataTable
        Dim AerialConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("aerialConnectionString").ConnectionString)
        Dim MediaArchive As New Data.DataTable
        Dim reader As SqlDataReader
        
        Try
            AerialConnection.Open()
            Dim SelectMediaArchiveCommand = New SqlCommand("EXEC spSearch @keywords", AerialConnection)
            SelectMediaArchiveCommand.Parameters.AddWithValue("keywords", SearchString)
            reader = SelectMediaArchiveCommand.ExecuteReader()
            MediaArchive.Load(reader)
        Catch e As Exception
        Finally
            AerialConnection.Close()
        End Try
        Return MediaArchive
    End Function

How can I code this to respond to different Return values, or even error cod

Simple ASP.NET SOAP request to return string

  

Hi,

I have a requirement to build a simple ASP.NET web page which sends some parameters to a web service, and then displays the string which was returned.

I'm a complete .NET newby and the only examples I can find seem really really complex.  I just need something mega simple, but which an handle parameters being sent to the web service.  Can anyone point me in the direction of a simple bit of C# which will do this with no frills or fuss?

Any help much appreciated, thanks!


No return from unmanaged code, methods to catch exception?

  

I am developing a c# application that needs to calls functions from a c header file. I use

[System.Runtime.InteropServices.DllImport("xxx.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true,SetLastError=true)]
        public static extern Byte xxxx(IntPtr hResourceContext, ushort xxxx, ref structa aaa,ref Result_struct Result, Byte b);

to import the dll method. When I call this method in C#, the application simply exits without throwing an exception or error. I've used similar approach for other methods from the same dll which involves passing nested structs as parameter and they work fine. I would like to know how I can debug the code/ catch errors/exceptions from the unmanaged code.

I tried to include the SetLastError=true during DllImport but it does not help.

Thanks!


Pass string to Javascript function from code-behind...

  

Hi!

I'm trying to send a error message to a javascript function from code-behind, but it's not working. When the javascript is executed the output error is: [object Object]

Here's my Javascript:

function Error(error) 
{
            document.getElementById("<%= errorText.ClientID %>").innerText = error;
}


And my C#:

try
{
        (...)
}
catch
{
        textError = "This is not working!!!";

        ScriptManager.RegisterStartupScript(Page, this.GetType(), "Error", "javascript:Error('" + textError + "');", true);                
}


Even if i pass the string instead of the 'textError' variable i still get the same error :(


Can anyone help me?





Calculating string length in points from code behind on the WEB server

  

Hi, I'm using the follow code to calculate some text by Font and Font Size:

//////////////////////////////////////////////////////////////////////////////////////

private decimal CalculateTextLength(string text, bool isTitle)
        {
            Font DrawFont = null;
            Graphics DrawGraphics = null;
            Bitmap TextBitmap = null;
            try
            {
                // start with empty bitmap, get it's graphic's object
                // and choose a font
                TextBitmap = new Bitmap(1, 1);
                DrawGraphics = Graphics.FromImage(TextBitmap);
               

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