[CLOSED] Server Control, Bin Items Direct Event Submission

Page 2 of 2 FirstFirst 12
  1. #11
    Hello, Rob!

    Sorry, I might have missed something. Which Visual Studio version are you using? I don't seem to be able to build custom controls like you did here. I could do something similar on C#, but the same code translated to VB.NET does not work. It never recognizes the component, and the designer.cs file makes a Global.Custom.Controls that can never be resolved, no matter what I try.

    In C# the same approach works just fine here.

    Maybe you are using a project template that allows you to use that on VB.Net. Are you using something different than Visual Basic's ASP.NET Web Application?

    But your code sample seems completely sane. My Visual Studio installatior, the project template, or something like it is just not right.

    EDIT: Finally I got it working! Visual Studio's VB.NET template (at least for Web Applications) does not handle namespaces or class names correctly if you have an space character on the project's name. It also requires constant file closing and reopening in order to refresh its intellisense data.
    Last edited by fabricio.murta; Feb 19, 2015 at 2:25 AM.
    Fabrício Murta
    Developer & Support Expert
  2. #12
    Hello again Rob!

    It was a thousand times harder to make VB work here than to find an actual alternative for you. I really hope this time it can solve your issue!

    If the example you provided really reproduces your scenario with your limitations you have, the resolution for it will be this:
                Dim selectedCustomer = DirectCast(FindControl("cb_customer_dd"), Ext.Net.ComboBox).SelectedItem
                Dim cust_id = selectedCustomer.Value
    While you are evaluating the current cust_id value that is selected on the combo box (line 172 of your code). It is specially important to have the combo box set in markup for this to work though. I really hope your combo box is not also another custom control! :)
    Fabrício Murta
    Developer & Support Expert
  3. #13
    Fabricio-

    Thanks for all of your hard work. (I am using Visual Studio 2013)

    And I know about getting the server control to register. It is a pain in the butt! I messed around with it for about 1/2 a day before I got it working correctly earlier in the week. My server control was working but intellisense would not pick it up.

    I actually ended up resetting Visual Studio settings following this:

    Close Visual Studio. Delete the <ProjectName>.v12.suo file. Reopen solution.

    Tools > Import and Export Settings... > Reset all settings.

    This does reset ALL the settings of Visual Studio, so sometimes a pain to set back up the way you want.

    I find now when I add a new server control, I need to build the solution a few times and then a few minutes later intellisense starts recognizing it. I really have no idea why it is or wasn't working but I am glad it is working now.

    Real Issue:

    Thanks for the help on this.

     Dim selectedCustomer = DirectCast(FindControl("cb_customer_dd"), Ext.Net.ComboBox).SelectedItem
    This will help me. I can pass the name of the control into a property of the server control, so the server control is not tied into that particular control.

    The other way I am investigating, is to use a Session variable or a ViewState variable. Not my desired approach, but I can set an object to the session variable and have complete access to it in the codebehind. I did that last night and it was the easiest and cleanest way that I have found.

    Also then the server control is completely stand alone, meaning it is not tied into anything on the particular parent page and is highly reusable.

    Thanks again for your time.
    -Rob
  4. #14
    Hello, Rob!

    For the control issue, I've isolated the problem like that:
    - Add your control code (in code behind)
    - Add your register line (in the page code): you -must- use assembly and -must- prefix the project name from the Namespace. E.g.:
    In code behind:
    Namespace MyCustomControl
        Public Class test
            Inherits WebControl
        End Class
    End Namespace
    <%@ Register TagPrefix="ctlPfx" Namespace="MyProjectName.MyCustomControl" Assembly="MyProjectName" %>
    Then, I don't try to use the TagPrefix yet.
    - Hit F6 to recompile the project (might be a needed to clean the project, but not really required)
    - Close the .aspx file
    - Open it again
    - IntelliSense will catch your tag.

    You'll need to rebuild and reopen the .aspx file every time you add a new control to your namespace.

    Well but, back to the main subject,

    In general terms, what you change in the page not always gets back to Code Behind. Although what you do in code behind is always reflected in the generated JavaScript. That is kind of inherent of Asp.NET page cycles and also to avoid too much data traffic by uploading carrying all controls info in every postBack.

    So if there is one setting you really need to be sent back in the postBack, its better not as a server control, but actual post data, which are values in fields. And that's why using hidden fields used to work for you. But if you already have the field defined, there's no reason to duplicate the information, is there?

    I hope this information helps on your second option investigation.
    Fabrício Murta
    Developer & Support Expert
  5. #15
    Thanks again, Fabricio.

    I think the session variable will work best in my case. I have over 20 parameters that can be set for the data retrieval.

    Using the session variable I just create an class/object the holds all of the parameters and push that into the session. This way I don't have to manage the parameters through hidden fields.

    And actually I am displaying the server control through a window, so when the window is closed I can remove the session variable.

    One more question, though it is unrelated.

    I would like to use the Ext.Net 3.1 version. I have got into the SVN but I can't find the latest DLL to download.

    I do not need to compile the Ext.Net newest version or view the source code, I would just like to know how to download the latest DLL(s).

    I have searched the forms and there is no tutorial on how to do this.

    Thanks again for all of your help!
    -Rob
  6. #16
    Here is the reply for your DLL question. If still in doubt, let us know.
    Fabrício Murta
    Developer & Support Expert
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] How to create tab control from direct event
    By huannv in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 29, 2015, 7:24 AM
  2. Replies: 11
    Last Post: Feb 08, 2014, 6:45 AM
  3. [CLOSED] Direct Event arguments on server side
    By anup in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 06, 2012, 8:25 PM
  4. Replies: 2
    Last Post: May 21, 2012, 9:25 AM
  5. Replies: 3
    Last Post: May 11, 2010, 10:36 AM

Posting Permissions