I'm not sure what you mean by database control, but if you want to access
something that's in a user control from the main page, that isn't too hard.
Since you haven't given too much information, I see two possibilities: Your
user control is either static or dynamic. In both cases its just a matter
of setting the information you want public, or the methods you want to be
able to call to public.
public class myControl
inherits UserControl
private _isLoaded as boolean = tru
public readonly property IsLoaded() as boolean
get
return _isLoaded
end get
end property
....
public sub DoSomething()
End Sub
...
end class
from webform1, you are loading the control like:
<mytag:myControl id="mine" runat="server" />
you can simply access mine.IsLoaded or mine.DoSomething
If you are dynamically loading the control, like:
Dim c as Control = Page.LoadControl("MyControl.ascx")
somePlaceholder.Controls.add(c)
you simply need to properly cast the control -->
Dim c as MyControl= ctype(Page.LoadControl("MyControl.ascx"), MyControl)
dim controlLoaded as boolean = c.IsLoaded
c.DoSomething
somePlaceholder.Controls.add(c)
Hope this Helps
Karl
"Unknown-Services" <Un**************@discussions.microsoft.com> wrote in
message news:98**********************************@microsof t.com...
Ok that worked. Now I have another problem.
I have database controls in my user control and I want to access them from
my WebForm1.aspx. I found this on the net but I can't seem to figure out
where to put the code. I"m not even sure if this will help me out with my
problem
http://www.devx.com/vb2themax/Tip/18843
"Karl" wrote:
How are you raising the event? You should be hooking into the
repeater's OnITemCommand event...not the linkbutton's click event..
Karl
"UnknownServices" <Un*************@discussions.microsoft.com> wrote in
message news:51**********************************@microsof t.com... I've added a LinkButton to a repeater control and I set the link
button as follows:
<asp:LinkButton ID="DLLinkButton" CommandArgument='<%#
DataBinder.Eval(Container.DataItem, "DownloadID")%>' Runat=server
CommandName="DLCount" >Download Now!</asp:LinkButton>
When I click this button it dosen't do anything instead of calling the
function I created.
BTW, is this the best way to go about calling the function? I tried
putting in the onClick command the following:
OnClick='<% DLCount(DataBinder.Eval(Container.DataItem,
"DownloadID"))%>'
But that didn't work. Any Ideas?