|
 |
asp_components thread: two question about my ActiveX control
Message #1 by "cindy zhou" <czhou@w...> on Fri, 28 Feb 2003 14:09:27
|
|
Hi,
I am building this Autocomplete list ActiveX control for my ASP
application. Basically it only contains a combobox in VB (style: 1 simple
combo), populated with data from SQL server, but it has the auto complete
function. (Since I think there is no such function in HTML drop-down
list). It works fine on my ASP page. But I am thinking to implement two
more things in my ActiveX control.
1. Every time when I select an item in the control and submit it to the
server, the same asp page returns with the control and the information
about the item. I need the selected item value shows in textbox of the
control (like set to the combobox.text in vb). I set a
property "combotext" of the control, assign it with the select item when
submitting the page. But the problem is that when the page returns, a new
instance of the control is created, since I loaded the combo items in
usercontrol_initialze(), and I have no clue how I can set combobox.text by
passing some external data in the initialize event.
2. The second question is similar to the first one. I need to populate the
control with different recordset of different queries. But again I don't
know how to achieve it in the initialize event of the control. OR is it
not possible at all?
I would really appreciate your help.
cindy
Message #2 by "Adrian Forbes" <adrian.forbes@n...> on Fri, 28 Feb 2003 14:25:39 -0000
|
|
> 1. Every time when I select an item in the control and submit it
> to the server, the same asp page returns with the control and
> the information about the item.
The ASP page will need to tell the form page what the combo should
display;
<%
sText = Request("cboComboBox")
DoSomethingWith sText
Response.redirect "FormPage.asp?ComboData=" & sText
%>
When FormPage.asp is loaded it will need to read the value from the URL
(Request("ComboData")) and set that as the combo box's default text.
> 2. The second question is similar to the first one. I need to
> populate the control with different recordset of different queries.
What do you mean?
Message #3 by "cindy zhou" <czhou@w...> on Fri, 28 Feb 2003 15:09:22
|
|
Adrian:
Thanks very much for you quick response.
I think I did not make myself clear in my previous message. The combo
control is an activex control I built in visual basic. I set a property of
the control that equals to the selected value, so I don't have problem to
get and pass this value in my ASP page. My problem is that how I can set
this value back to combo control as its default value. Every time when the
formpage.asp (that contains the combo control) is loaded, a new instance
of the control is created, so I need somehow to pass the value in the
initialize event (in visual basic) of the control so that the control will
appear with that value as default value when page loaded.
My second question is similiar. Since the combobox in my control is
populated in the initialize event (in visual basic), I don't know how to
do population with different query string which is determined by my asp
page.
Cindy
> > 1. Every time when I select an item in the control and submit it
> to the server, the same asp page returns with the control and
> the information about the item.
The ASP page will need to tell the form page what the combo should
display;
<%
sText = Request("cboComboBox")
DoSomethingWith sText
Response.redirect "FormPage.asp?ComboData=" & sText
%>
When FormPage.asp is loaded it will need to read the value from the URL
(Request("ComboData")) and set that as the combo box's default text.
> 2. The second question is similar to the first one. I need to
> populate the control with different recordset of different queries.
What do you mean?
Message #4 by "Adrian Forbes" <adrian.forbes@n...> on Fri, 28 Feb 2003 14:59:43 -0000
|
|
> so I need somehow to pass the value in the initialize event (in
> visual basic) of the control so that the control will
> appear with that value as default value when page loaded.
Can't you set it as one of the control's parameters via the OBJECT tag?
> Since the combobox in my control is populated in the initialize
> event (in visual basic), I don't know how to do population
> with different query string which is determined by my asp
Remember that your activex control is on the client and can't interact
with anything in ASP. If you want your combo box to populate itself
with different values then give it a method that can be called from
script on your web page.
I think you might be getting things in a bit of a tangle though.
Message #5 by "cindy zhou" <czhou@w...> on Fri, 28 Feb 2003 15:51:16
|
|
I think you are absolute right. I did get the control's selected value
through script (i.e. client-side). The problem is that I cannot pass any
parameter in the control's initilize event, so there is not way to
interactively set my control at design time after submitting the original
form page. Adding extra method seems not a solution at this time.
> > so I need somehow to pass the value in the initialize event (in
> visual basic) of the control so that the control will
> appear with that value as default value when page loaded.
Can't you set it as one of the control's parameters via the OBJECT tag?
> Since the combobox in my control is populated in the initialize
> event (in visual basic), I don't know how to do population
> with different query string which is determined by my asp
Remember that your activex control is on the client and can't interact
with anything in ASP. If you want your combo box to populate itself
with different values then give it a method that can be called from
script on your web page.
I think you might be getting things in a bit of a tangle though.
|
|
 |