Professional Web Applications Themes

Guru's Challenge: How to place multiple instances of a control in a single page in an abnormal situation - ASP.NET Data Grid Control

I am relatively new to .Net and have been coding an intranet site for my employer for a couple of months. I am currently stuck coding in a text-editor called EditPlus without access to the VS.Net IDE, and coding pages with the script directly in each page (not using the codebehind method) as most of my learning material has demonstrated. I started with the IBuySpy Portal (SDK version not VS Version) as my base portal and have coded custom controls and pages within the portal. My employer recently requested that I change one of my pages so that at a ...

  1. #1

    Default Guru's Challenge: How to place multiple instances of a control in a single page in an abnormal situation

    I am relatively new to .Net and have been coding an intranet site for my
    employer for a couple of months. I am currently stuck coding in a
    text-editor called EditPlus without access to the VS.Net IDE, and coding
    pages with the script directly in each page (not using the codebehind
    method) as most of my learning material has demonstrated. I started with
    the IBuySpy Portal (SDK version not VS Version) as my base portal and have
    coded custom controls and pages within the portal.

    My employer recently requested that I change one of my pages so that at a
    click of a button a section of code, including roughly 23 asp WebServer
    Controls, can be repeated so that the user can enter multiple sets of the
    same information into one SQL Server table when they save the information on
    the page (along with the main information in another table). I had already
    designed the tables with this in mind, however I am having some problems
    with getting the .Net code to function correctly. The way the original page
    was designed was that when a user clicked on one of three different buttons
    in this section in question the cooresponding popup window was called which
    loaded a lookup(aspx) page. When the user clicked on a hyperlink in the
    lookup page the 23 controls on the main page were populated from SQL Server
    tables (via JavaScript) and the popup window closed. Although I'm sure
    there's a better way to do it, I used JavaScript to pass the variables back
    to the main window because I knew how to do it. Since the change request
    came in have I moved this section of 23 controls into an ascx file, removed
    the popup windows(lookups), and am able to call it with the click of a
    button. Into a table column formatted as follows: <td id="ContentPane"
    colspan="2" runat="server"></td>

    Unfortunately, my method has left me no way to reference the controls or get
    the popup windows to function correctly. Each one of the newly displayed
    controls have names like _ctl1:Phone, _ctl2:Phone, _ctl3:Phone, etc for each
    time I add the control. Furthermore I am not able to retain information in
    a given control instance. The way I currently have the code designed is
    that a counter increments everytime the "Add" button is pressed. This
    determines the number of times to add the control by looping through the
    following code:

    Control parent = Page.FindControl("ContentPane");
    PortalModuleControl portalModule = (PortalModuleControl)
    Page.LoadControl("Children.ascx");
    parent.Controls.Add(portalModule);

    Everything I have read indicates that I need to have this control inside
    some container such as a datagrid or datalist in order to reference it
    correctly. However all of my efforts have met with failure. The biggest
    problem I have is that I don't even know if what I am trying to do can be
    done much less how to do it. If anyone has any idea how I can get this
    functioning correctly and/or how I can reference each new control instance,
    while limited by my current coding environment
    please, please, please, let me know.

    Thanks in advance,

    Jeff


    .Net Newbie Guest

  2. #2

    Default Re: Guru's Challenge: How to place multiple instances of a control in a single page in an abnormal situation

    Newbie,
    I don't quite know if I understand what you are trying to do, but... You
    have 23 controls that make up a single record? You want to be able to add
    multiple instances of the same 23 controls to a single page so a user can
    insert multiple records at once, right? Are your 23 controls inside of a
    custom usercontrol? Datalist? Datagrid?
    You may have to post some of your relevent code for someone to help.

    You may look creating a new datatable,dataset object (.Net) and create a new
    row, then, update the database after the user is finished.

    Jared

    ".Net Newbie" <jcrumblehotmail.com> wrote in message
    news:OPX4lpYdEHA.1048tk2msftngp13.phx.gbl...
    >I am relatively new to .Net and have been coding an intranet site for my
    > employer for a couple of months. I am currently stuck coding in a
    > text-editor called EditPlus without access to the VS.Net IDE, and coding
    > pages with the script directly in each page (not using the codebehind
    > method) as most of my learning material has demonstrated. I started with
    > the IBuySpy Portal (SDK version not VS Version) as my base portal and have
    > coded custom controls and pages within the portal.
    >
    > My employer recently requested that I change one of my pages so that at a
    > click of a button a section of code, including roughly 23 asp WebServer
    > Controls, can be repeated so that the user can enter multiple sets of the
    > same information into one SQL Server table when they save the information
    > on
    > the page (along with the main information in another table). I had
    > already
    > designed the tables with this in mind, however I am having some problems
    > with getting the .Net code to function correctly. The way the original
    > page
    > was designed was that when a user clicked on one of three different
    > buttons
    > in this section in question the cooresponding popup window was called
    > which
    > loaded a lookup(aspx) page. When the user clicked on a hyperlink in the
    > lookup page the 23 controls on the main page were populated from SQL
    > Server
    > tables (via JavaScript) and the popup window closed. Although I'm sure
    > there's a better way to do it, I used JavaScript to pass the variables
    > back
    > to the main window because I knew how to do it. Since the change request
    > came in have I moved this section of 23 controls into an ascx file,
    > removed
    > the popup windows(lookups), and am able to call it with the click of a
    > button. Into a table column formatted as follows: <td id="ContentPane"
    > colspan="2" runat="server"></td>
    >
    > Unfortunately, my method has left me no way to reference the controls or
    > get
    > the popup windows to function correctly. Each one of the newly displayed
    > controls have names like _ctl1:Phone, _ctl2:Phone, _ctl3:Phone, etc for
    > each
    > time I add the control. Furthermore I am not able to retain information
    > in
    > a given control instance. The way I currently have the code designed is
    > that a counter increments everytime the "Add" button is pressed. This
    > determines the number of times to add the control by looping through the
    > following code:
    >
    > Control parent = Page.FindControl("ContentPane");
    > PortalModuleControl portalModule = (PortalModuleControl)
    > Page.LoadControl("Children.ascx");
    > parent.Controls.Add(portalModule);
    >
    > Everything I have read indicates that I need to have this control inside
    > some container such as a datagrid or datalist in order to reference it
    > correctly. However all of my efforts have met with failure. The biggest
    > problem I have is that I don't even know if what I am trying to do can be
    > done much less how to do it. If anyone has any idea how I can get this
    > functioning correctly and/or how I can reference each new control
    > instance,
    > while limited by my current coding environment
    > please, please, please, let me know.
    >
    > Thanks in advance,
    >
    > Jeff
    >
    >

    Jared Guest

Similar Threads

  1. Multiple CF7 Instances On Single IIS Website
    By ktodd in forum Coldfusion Server Administration
    Replies: 0
    Last Post: February 8th, 09:22 PM
  2. multiple instances single VirtualHost
    By dlutzy in forum Coldfusion Server Administration
    Replies: 2
    Last Post: June 17th, 12:21 AM
  3. Single instance or multiple instances
    By jamezw in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: February 16th, 07:16 PM
  4. Multiple instances of a control? <img> ??
    By Kristoffer Arfvidson in forum ASP.NET Web Services
    Replies: 1
    Last Post: December 21st, 03:51 PM
  5. Multiple Composite Control Instances
    By Russ in forum ASP.NET Building Controls
    Replies: 8
    Last Post: September 18th, 08:30 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139