Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

bnieland

@bnieland
About
Posts
15
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Extending javascript types generated by ASP.NET
    B bnieland

    Folks,

    How can I add functions to a JavaScript type generated by using the GenerateScriptType in a web service.
    Basicly, the C# class has data members that are serialized and passed to the client to be deserialized javascript objects whoose type bears the same name as the c# type.
    Of course, methods can not be shared.
    So let's say I have a c# type

    /////////////////////////
    // BEGIN FILE: CDog.cs //
    /////////////////////////
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    namespace AddJavascriptMethodTest
    {
    [Serializable]
    public class CDog
    {
    public CDog()
    {
    this._sColor = "Brown";
    }
    public CDog(string sColor)
    {
    this._sColor = sColor;
    }

        private string \_sColor = null;
    
        public string Color { get { return \_sColor; } }
    }
    

    }
    /////////////////////////
    // END FILE: CDog.cs //
    /////////////////////////

    Then I create a web service to return an object of CDog. I also add a GenerateScriptType attribute to generate a javascript type called AddJavascriptMethodTest.CDog

    ////////////////////////////////
    // BEGIN FILE: wsAnimals.asmx //
    ////////////////////////////////
    using System.Web.Services;
    using System.Web.Script.Services;

    namespace AddJavascriptMethodTest
    {
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class wsAnimals : System.Web.Services.WebService
    {
    [WebMethod]
    [GenerateScriptType(typeof(CDog))]
    public CDog GetDog()
    {
    return new CDog("Red");
    }
    }
    }
    ////////////////////////////////
    // END FILE: wsAnimals.asmx //
    ////////////////////////////////

    Now, the default.aspx looks like this (and this version works fine)...

    <!--/////////////////////////////-->
    <!-- BEGIN FILE: Default.aspx //-->
    <!--/////////////////////////////-->
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AddJavascriptMethodTest._Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www

    ASP.NET csharp javascript html asp-net linq

  • capture audio in Web App
    B bnieland

    Lawrence, You would have to get an executable on to the client machine to do this, or use an existing one (such as Flash, which has microphone support). Any commercial plug-in will be designed prompt the user before allowing you to listen in. Best,

    DTrent

    ASP.NET csharp asp-net sysadmin help question

  • Powerpoint functionality on a server - 3rd party apps?
    B bnieland

    aspose powerpoinr DTrent

    ASP.NET help question sysadmin workspace

  • Impress a Girl
    B bnieland

    Listen. Ask about what she does, went to vacation last, whatever, and listen very carefully to what she is interested in/excited about. Ask more about that, and hopefully you might know just enough about it to allow you to ask interesting questions. Admit your ignorance in any case, let her teach you about it and get excited about what she is excited about. You will end up with respect for her intellectually, and she will know it. This will impress her. DTrent

    The Lounge question

  • Best practices question: do you comment out or delete old code?
    B bnieland

    I use regions for commented blocks that I am not quite ready to remove i.e. #region deprecated 2/26 /* COMMENTED CODE */ #endregion I use this both internally in methods and on the class level. From time to time I search the code for these entries and delete those that are more than a few days old. Brett Nieland

    The Lounge question com

  • North America Settled by Just 70 People
    B bnieland

    Any links? DTrent

    The Lounge html com

  • ASP.net hosting
    B bnieland

    http://www.brinkster.com free asp.net hosting with MSAccess support, but you have to have your cs code in your aspx page. For a small fee this restriction is lifted I think. DTrent

    ASP.NET csharp asp-net database sql-server sysadmin

  • Transfering array from javascript to c#
    B bnieland

    - GIVEN: The form name is FFFF - Create a hidden form variable on the aspx page with an name/id of HHH - GIVEN: the name of the arry is ZZZ - using Javascript assign the array value somewhere before postback - document.FFFF.HHH.value = ZZZ.join() //This creates a comma delimited string - Retrieve the hidden HHH on the server side and use.. Array x; string s = Request.Form["HHHH"]; X = s.Split(','); DTrent

    ASP.NET csharp javascript asp-net data-structures help

  • Stored Proc not returning my Output
    B bnieland

    Post your ADO code where you get NewDateModified out of the command object... DTrent

    Database help database announcement

  • Generating strings that are matched by a regex
    B bnieland

    Thanks, That might help a lot! DTrent

    C# csharp algorithms regex question lounge

  • How Windows works...
    B bnieland

    Great comment. Just reading a book on C windows programming will help. Writting even a few simple apps will give you a real good idea what is going on. DTrent

    C# question learning

  • Abstract, Interface, and Attribute
    B bnieland

    By decorating your class with the Serializable attribute you are just telling other classes that you pass it to that it is "auto-serializable", by which it is meant that it contains no volatile references (i.e. a SQLConnection object) or references to other classes that are not serializable. This way a remoting object (for example) knows that it does not need any special instructions to serialize/deserialize. DTrent

    C# csharp asp-net design oop question

  • Generating strings that are matched by a regex
    B bnieland

    Folks, For bizarre reasons, I need to be able to generate random strings that will be matched by a given regex. i.e. given [a-z][a-z1-9][qrst] I want an algorithm that will generate abs z9q dvt et cetera... Anyone hear of anything similar? Or maybe you know a simple regex parser that I cannibalize? (C# preferable, or a C related language) Thanks, Brett DTrent

    C# csharp algorithms regex question lounge

  • Developing a Client/Server application
    B bnieland

    You want this book as reffed in this thread, it shows an implementation of an encrytion sink for remoting in Chapter 9. Remoting does seem to be your answer. DTrent

    C# question csharp sysadmin xml performance

  • 103
    B bnieland

    I am a no TV man myself. For entertainment while doing tedious tasks (or while sick) I listen to books on tape, or audible.com... DTrent

    The Lounge csharp com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups