473,651 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repeater LinkButton

I've added a LinkButton to a repeater control and I set the link button as
follows:

<asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem, "DownloadID"))% >'

But that didn't work. Any Ideas?
Nov 18 '05 #1
5 5436
How are you raising the event? You should be hooking into the repeater's
OnITemCommand event...not the linkbutton's click event..

Karl

"UnknownService s" <Un************ *@discussions.m icrosoft.com> wrote in
message news:51******** *************** ***********@mic rosoft.com...
I've added a LinkButton to a repeater control and I set the link button as
follows:

<asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem, "DownloadID"))% >'

But that didn't work. Any Ideas?

Nov 18 '05 #2
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:myContro l id="mine" runat="server" />

you can simply access mine.IsLoaded or mine.DoSomethin g

If you are dynamically loading the control, like:

Dim c as Control = Page.LoadContro l("MyControl.as cx")
somePlaceholder .Controls.add(c )

you simply need to properly cast the control -->
Dim c as MyControl= ctype(Page.Load Control("MyCont rol.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******** *************** ***********@mic rosoft.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

"UnknownService s" <Un************ *@discussions.m icrosoft.com> wrote in
message news:51******** *************** ***********@mic rosoft.com...
I've added a LinkButton to a repeater control and I set the link button as follows:

<asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem, "DownloadID"))% >'
But that didn't work. Any Ideas?


Nov 18 '05 #3
Hmm.. I really couldn't understand your post very well. May you please
reexplain it?

In my User Control (.ascx file) I have a DataSet, DataConnection etc. that
are all set to public and are created through VS.NET's designer. I'm trying
to access them from a regular page (. aspx file) so I can run some code
using them.. Hope this explains more of what I need.

"Karl" wrote:
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:myContro l id="mine" runat="server" />

you can simply access mine.IsLoaded or mine.DoSomethin g

If you are dynamically loading the control, like:

Dim c as Control = Page.LoadContro l("MyControl.as cx")
somePlaceholder .Controls.add(c )

you simply need to properly cast the control -->
Dim c as MyControl= ctype(Page.Load Control("MyCont rol.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******** *************** ***********@mic rosoft.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

"UnknownService s" <Un************ *@discussions.m icrosoft.com> wrote in
message news:51******** *************** ***********@mic rosoft.com...
> I've added a LinkButton to a repeater control and I set the link button as > follows:
>
> <asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
> DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
> CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem, "DownloadID"))% >' >
> But that didn't work. Any Ideas?


Nov 18 '05 #4
How are you including this User Control on your main page? If you aren't,
then you shouldn't be using a UserControl, but instead should just be
creating a plain class. Did yo drag and drop your user control on your aspx
file? Does your User Control do anything visual or is it just business
logic (connect to DB, return dataset?). The explanation bellow assums you
are including the user control in your page for some type of visual
stuff...which is why you use a user control. Your follow up posts makes me
think maybe you just want a normal class (.vb).

Please let me know :)

Karl

"Unknown-Services" <Un************ *@discussions.m icrosoft.com> wrote in
message news:CA******** *************** ***********@mic rosoft.com...
Hmm.. I really couldn't understand your post very well. May you please
reexplain it?

In my User Control (.ascx file) I have a DataSet, DataConnection etc. that
are all set to public and are created through VS.NET's designer. I'm trying to access them from a regular page (. aspx file) so I can run some code
using them.. Hope this explains more of what I need.

"Karl" wrote:
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:myContro l id="mine" runat="server" />

you can simply access mine.IsLoaded or mine.DoSomethin g

If you are dynamically loading the control, like:

Dim c as Control = Page.LoadContro l("MyControl.as cx")
somePlaceholder .Controls.add(c )

you simply need to properly cast the control -->
Dim c as MyControl= ctype(Page.Load Control("MyCont rol.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******** *************** ***********@mic rosoft.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
>
> "UnknownService s" <Un************ *@discussions.m icrosoft.com> wrote in > message news:51******** *************** ***********@mic rosoft.com...
> > I've added a LinkButton to a repeater control and I set the link

button as
> > follows:
> >
> > <asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
> > DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
> > CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem,

"DownloadID"))% >'
> >
> > But that didn't work. Any Ideas?
>
>
>


Nov 18 '05 #5
I use it as a menu and for hte database controls. I did drag the Data
Controls to the designer from the toolbox. But can you tell me how to make a
class that I can reuse or possibly give me a link for a tutorial or
something. Anything would be of great help.

BTW: Whats the best way to add a use control to a page?

Through the code-behind or through the html?

"Karl" wrote:
How are you including this User Control on your main page? If you aren't,
then you shouldn't be using a UserControl, but instead should just be
creating a plain class. Did yo drag and drop your user control on your aspx
file? Does your User Control do anything visual or is it just business
logic (connect to DB, return dataset?). The explanation bellow assums you
are including the user control in your page for some type of visual
stuff...which is why you use a user control. Your follow up posts makes me
think maybe you just want a normal class (.vb).

Please let me know :)

Karl

"Unknown-Services" <Un************ *@discussions.m icrosoft.com> wrote in
message news:CA******** *************** ***********@mic rosoft.com...
Hmm.. I really couldn't understand your post very well. May you please
reexplain it?

In my User Control (.ascx file) I have a DataSet, DataConnection etc. that
are all set to public and are created through VS.NET's designer. I'm

trying
to access them from a regular page (. aspx file) so I can run some code
using them.. Hope this explains more of what I need.

"Karl" wrote:
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:myContro l id="mine" runat="server" />

you can simply access mine.IsLoaded or mine.DoSomethin g

If you are dynamically loading the control, like:

Dim c as Control = Page.LoadContro l("MyControl.as cx")
somePlaceholder .Controls.add(c )

you simply need to properly cast the control -->
Dim c as MyControl= ctype(Page.Load Control("MyCont rol.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******** *************** ***********@mic rosoft.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
> >
> > "UnknownService s" <Un************ *@discussions.m icrosoft.com> wrote in > > message news:51******** *************** ***********@mic rosoft.com...
> > > I've added a LinkButton to a repeater control and I set the link
button as
> > > follows:
> > >
> > > <asp:LinkButt on ID="DLLinkButto n" CommandArgument ='<%#
> > > DataBinder.Eval (Container.Data Item, "DownloadID")%> ' Runat=server
> > > CommandName="DL Count" >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(DataBin der.Eval(Contai ner.DataItem,
"DownloadID"))% >'
> > >
> > > But that didn't work. Any Ideas?
> >
> >
> >


Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2131
by: Mark | last post by:
I am looking for an example of using checkboxes in a repeater control where the checkbox state is persisted from page to page. Thank you, Mark
0
1784
by: Amir | last post by:
Hi every one This is the problem: I have a UserControl that contains a Repeater and a few LinkButton. The Repeater generate some linkButton. I use this control for implementing paging solution for another repeater in page. (So I have a repeater and a Usercontrol that contains repeater)
1
5428
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a fragment of a very simple page that I wrote that will drill down into the displayed item. The result is to be display on the same page so that the user can keep on drilling down:
3
4146
by: Shimon Sim | last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as onclick="btnSort_Click". Made btnSort_Click method public. It doesn't fire if I click on it. I tried to attach it in ItemDataBound event but I think it is too late. What am I doing wrong? Thanks Shimon.
1
6414
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ? I'm posting my code below. The problem is that if i click on "AdjustThisAd" button, it opens...
3
7813
by: renil | last post by:
I have a repeater control that displays info. from a datatable. Each row in the repeater has a checkbox. Also, I have a delete linkbutton outside the repeater control. What I'm trying to do when the delete linkbutton is clicked is get the SubscriptionID from the repeater control for each row in which the checkbox is checked, then call a delete function. (See the code for the .aspx and .aspx.cs below.) The problem I'm having is that I...
0
2799
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2272
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2558
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
5
13919
by: Peter Larsen [CPH] | last post by:
Hi, The following sample shows a LinkButton in the HeaderTemplate of a Repeater control. The problem is that i'm not able to access the linkbutton in code (in the cs file) as long as the linkbutton stays in the repeater control - see the following line: testLink.CommandArgument = "just testing"; or testLink.Text = "Some new text";
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8700
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.