I want to read information out of a database at runtime (names of files available to download) and create a list of linkbuttons that the user can click on to download the file(s).
How can I accomplish this.
I've got this far:
In the html:
....
table>
<asp:Repeater ID="softwareLis t" Runat="server">
<ItemTemplate >
<tr>
<td>
<asp:LinkButt on Runat="server">
<%# DataBinder.Eval (Container.Data Item,"SoftwareP ath") %>
</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
In the codebehind page:
private void Page_Load(objec t sender, System.EventArg s e)
{
if ( !Page.IsPostBac k )
{
sqlDataAdapter1 .Fill(dataSet11 );
softwareList.Da taSource = dataSet11;
softwareList.Da taBind();
}
}
This reads the information out of the database and displays the items as links, but how do I "bind" the links to be able to download the file.
For example,
say my list looks like:
your_software_o ne.exe
more_software.e xe
what more do I need to do to create the "click" event for each of these links to pass the filepath information to the download routine? 2 10772
You should add an OnCommand event handler tot he LinkButtons. In that event
handler you'll need to know which thing to download, so I'd suggest also
supplying a CommandName='<% # 'DataBinder.Eva l(COntainer.Dat aItem, "SomeIDForYourD ownload")%>'
then in your event handler simply check the COmmandName to know what to send
back via Response.Binary Write().
-Brock
DevelopMentor http://staff.develop.com/ballen I want to read information out of a database at runtime (names of files available to download) and create a list of linkbuttons that the user can click on to download the file(s).
How can I accomplish this.
I've got this far:
In the html:
...
<asp:Repeater ID="softwareLis t" Runat="server"> <ItemTemplate > <tr> <td> <asp:LinkButt on Runat="server"> <%# DataBinder.Eval (Container.Data Item,"SoftwareP ath") %> </asp:LinkButton> </td> </tr> </ItemTemplate> </asp:Repeater> </table> In the codebehind page:
private void Page Load(object sender, System.EventArg s e) { if ( !Page.IsPostBac k ) { sqlDataAdapter1 .Fill(dataSet11 ); softwareList.Da taSource = dataSet11; softwareList.Da taBind(); } } This reads the information out of the database and displays the items as links, but how do I "bind" the links to be able to download the file. For example, say my list looks like:
your software one.exe more software.exe what more do I need to do to create the "click" event for each of these links to pass the filepath information to the download routine?
Brock,
Thaks for the reply - where/how do I add the OnCommand event handler - on
the codebehind page?
A quick snippet would be helpful - thanks!
"Brock Allen" <ba****@NOSPAMd evelop.com> wrote in message
news:b8******** *************** ***@msnews.micr osoft.com... You should add an OnCommand event handler tot he LinkButtons. In that event handler you'll need to know which thing to download, so I'd suggest also supplying a CommandName='<% # 'DataBinder.Eva l(COntainer.Dat aItem, "SomeIDForYourD ownload")%>' then in your event handler simply check the COmmandName to know what to send back via Response.Binary Write().
-Brock DevelopMentor http://staff.develop.com/ballen
I want to read information out of a database at runtime (names of files available to download) and create a list of linkbuttons that the user can click on to download the file(s).
How can I accomplish this.
I've got this far:
In the html:
...
<asp:Repeater ID="softwareLis t" Runat="server"> <ItemTemplate > <tr> <td> <asp:LinkButt on Runat="server"> <%# DataBinder.Eval (Container.Data Item,"SoftwareP ath") %> </asp:LinkButton> </td> </tr> </ItemTemplate> </asp:Repeater> </table> In the codebehind page:
private void Page Load(object sender, System.EventArg s e) { if ( !Page.IsPostBac k ) { sqlDataAdapter1 .Fill(dataSet11 ); softwareList.Da taSource = dataSet11; softwareList.Da taBind(); } } This reads the information out of the database and displays the items as links, but how do I "bind" the links to be able to download the file. For example, say my list looks like:
your software one.exe more software.exe what more do I need to do to create the "click" event for each of these links to pass the filepath information to the download routine?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stan |
last post by:
I cannot make the link buttons fire ItemCommand from
repeater control.
Here is the code:
<asp:repeater id=rptLetters runat="server">
<itemtemplate>
<asp:linkbutton id="lnkLetter"
runat="server" commandname="Filter"
CommandArgument='<%#
|
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...
|
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 ?...
|
by: Jon S via DotNetMonster.com |
last post by:
Hi all
In short, I have a dataset that contains 10 records and the relevant headings.
All I want to do is bind this dataset to a asp.net repeater control. All the
examples I've seen create table cell headings and then map to them headings
like:
<%#DataBinder.Eval(Container.DataItem, "CompanyName")%>,...
|
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...
| |
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
------------
|
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= |
last post by:
Hi,
I wish to create a repeater control in c#.net that allows for the
selection of rows, any idea how this can be done.
Regards
Robert
|
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= |
last post by:
Hi I have a repeater control as shown below. The Itemtemplate contains a
table with linkbuttons in each column of the row. However I wish to change
the stlyle of the link button to
text-decoration:underline on mouseover and
text-decoration:none on mouseout
The link button does not have a mouseover attribute and it won't let me add on
Any...
|
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";
|
by: JFKJr |
last post by:
Hello Guys,
I have been trying to solve the following problem from past 3 days with no luck.
This is what I am trying to do:
I want to allow user (Professor) to choose a course material using "asp:FileUpload" control, upload into the database by clicking "asp:Button" control and allow Professor to view the files he/she uploaded using...
|
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...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
| |
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...
|
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
| |