SQLDataSource parameter referencing a text box in a user control?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VkIuTmV0IFBybw==?=

    SQLDataSource parameter referencing a text box in a user control?

    I have a user control (.ascx) with a combo box in it. I place it and a
    SQLDataSource control on a web form. I want a SQLDataSource parameter to
    point to the combo box, but it seems that the control parameters can only see
    controls in the same container.

    <asp:ControlPar ameter ControlID="cboP rojects"
    Name="ProjectID " PropertyName="S electedValue"
    Type="Int32" />


    The above works if cboProjects is in the same container, but not if it's in
    the .ascx. I've tried various names in the ControlID value i.e.
    mycontrol.cboPr ojects.

    Is there any way to make this work? My only other idea is a hidden text
    field and some code to fill it in. Not a very elegant solution, but I
    haven't found anything better.

    Thanks

  • Alexey Smirnov

    #2
    Re: SQLDataSource parameter referencing a text box in a user control?

    On Oct 16, 11:19 pm, VB.Net Pro <VBNet...@discu ssions.microsof t.com>
    wrote:
    I have a user control (.ascx) with a combo box in it.  I place it and a
    SQLDataSource control on a web form.  I want a SQLDataSource parameter to
    point to the combo box, but it seems that the control parameters can onlysee
    controls in the same container.
    >
                    <asp:ControlPar ameter ControlID="cboP rojects"
    Name="ProjectID " PropertyName="S electedValue"
                        Type="Int32" />
    >
    The above works if cboProjects is in the same container, but not if it's in
    the .ascx.  I've tried various names in the ControlID value i.e.
    mycontrol.cboPr ojects.  
    >
    Is there any way to make this work?  My only other idea is a hidden text
    field and some code to fill it in.  Not a very elegant solution, but I
    haven't found anything better.
    >
    Thanks
    ControlID="myco ntrol$cboProjec ts"

    Comment

    • =?Utf-8?B?VkIuTmV0IFBybw==?=

      #3
      Re: SQLDataSource parameter referencing a text box in a user contr

      Alexey,
      Thank you for your answer, that did it!

      "Alexey Smirnov" wrote:
      On Oct 16, 11:19 pm, VB.Net Pro <VBNet...@discu ssions.microsof t.com>
      wrote:
      I have a user control (.ascx) with a combo box in it. I place it and a
      SQLDataSource control on a web form. I want a SQLDataSource parameter to
      point to the combo box, but it seems that the control parameters can only see
      controls in the same container.

      <asp:ControlPar ameter ControlID="cboP rojects"
      Name="ProjectID " PropertyName="S electedValue"
      Type="Int32" />

      The above works if cboProjects is in the same container, but not if it's in
      the .ascx. I've tried various names in the ControlID value i.e.
      mycontrol.cboPr ojects.

      Is there any way to make this work? My only other idea is a hidden text
      field and some code to fill it in. Not a very elegant solution, but I
      haven't found anything better.

      Thanks
      >
      ControlID="myco ntrol$cboProjec ts"
      >

      Comment

      Working...