Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Page 4 of 4 FirstFirst 1234
Results 46 to 52 of 52

Thread: The .NET Knowledge Sharing Thread

  1. #46

    Default

    note to self
    when migrating a normal aspx page to a content page of a master page,
    make sure to remove the MOTHEREFFING scriptmanager from the content page!!
    its a know fact you cant have a scriptmanager on the content and master page, but theres no build error and its not always easy to see and remember

  2. #47

    Default

    note to self
    you cant get checkbox text property from javascript,
    because there is no text attribute,
    <input id="ctl00_ContentPlaceHolder1_CheckBoxList1_0" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList1$0" onclick="MyFunction(MyValue);" />
    <label for="ctl00_ContentPlaceHolder1_CheckBoxList1_0">Cu stomerName</label>
    workaround i used, pass the value in the onclick event, strip it from there

  3. #48

    Default

    A neater approach for when an event handler only has a few lines:

    myBtn.Clicked += (s,e)=>
    {
    //Do stuff here.
    //To get the sender either cast the s to whatever type it is like this:
    Button btn = s as Button;
    btn.Text = "hello";
    //Or use the original reference because we are still in the same context:
    myBtn.Text = "hello";
    };


    Note that you must never use the "myBtn" reference when creating objects and their handlers in a loop because no matter which object fires the event the "myBtn" reference will point to the last one. Use the sender.
    My Site: http://www.roguecode.co.za
    I make awesome WP apps - search the marketplace for 'RogueCode'!
    I also write for WPCentral

  4. #49

    Default

    In Silverlight there's a bug (well, probably an undocumented feature :P) where re-binding a control will sometimes throw a very unspecific error. First set the ItemSource to null then bind to fix it.
    My Site: http://www.roguecode.co.za
    I make awesome WP apps - search the marketplace for 'RogueCode'!
    I also write for WPCentral

  5. #50
    Grandmaster
    Join Date
    Nov 2007
    Location
    11,000ft in the sky
    Posts
    3,231

    Default

    Quote Originally Posted by roguemat View Post
    A neater approach for when an event handler only has a few lines:

    myBtn.Clicked += (s,e)=>
    {
    //Do stuff here.
    //To get the sender either cast the s to whatever type it is like this:
    Button btn = s as Button;
    btn.Text = "hello";
    //Or use the original reference because we are still in the same context:
    myBtn.Text = "hello";
    };


    Note that you must never use the "myBtn" reference when creating objects and their handlers in a loop because no matter which object fires the event the "myBtn" reference will point to the last one. Use the sender.
    **** like that makes me cringe.

    if you going to cast the button to a button just var btn = s as Button; or you mind as well just do ((Button)btn).Text = "Hello"; Furthermore i would rather use Rx for the event subscribing.

  6. #51
    Grandmaster
    Join Date
    Jul 2007
    Location
    Bryanston
    Posts
    4,511

    Default

    WCF windows service installation: you have to run your command prompt as admin.
    Shortest way is to create your Visual Studio Command Prompt (2010) a desktop shortcut and run as administrator

    Then cmd-> installutil whatever.exe
    or link or link 2
    Last edited by Fuma; 10-11-2011 at 09:52 AM.
    i7 2600 | Asus P8H67-M (Rev B3) | Corsair TX650 | CM Scout | Mushkin Silverline BBR3 1333 -2X4GB | DeepCool Tiger Shark | 1TB Samsung | LG DVD-Writer

  7. #52

    Default

    note to self
    visual studio: project cant compile but shows no errors : there could be a 2 pages with different aspx names, but with the same "Partial Class MyFile" in the solution.
    this will also have the effect that the moment you try to access any "new" control on that page, you will not be able to compile and if youre lucky you will get the message: labelXYZ is not a member of MyFile, even though you see labelXYZ - it means that the first MyFile does not have a labelXYZ and the project is trying to use the first instance of MyFile.

Page 4 of 4 FirstFirst 1234

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •