Click here to Skip to main content
15,888,802 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: SQL Server Express, Authentication, Visual Studio, and a Web Host that doesn't support SQL Server:( Pin
Rajeesh MP11-Mar-09 19:26
Rajeesh MP11-Mar-09 19:26 
Questionset a page as the main page Pin
prasadbuddhika11-Mar-09 17:44
prasadbuddhika11-Mar-09 17:44 
AnswerRe: set a page as the main page Pin
Abhijit Jana11-Mar-09 18:43
professionalAbhijit Jana11-Mar-09 18:43 
QuestionModify the SqlDataSource without altering the gridview Pin
TerRO_GirL11-Mar-09 11:43
TerRO_GirL11-Mar-09 11:43 
QuestionGridview SqlDataSource SelectCommand Pin
Tomb42111-Mar-09 10:29
Tomb42111-Mar-09 10:29 
AnswerRe: Gridview SqlDataSource SelectCommand Pin
Tomb42111-Mar-09 11:16
Tomb42111-Mar-09 11:16 
GeneralRe: Resolved: Gridview SqlDataSource SelectCommand Pin
Tomb42117-Mar-09 9:23
Tomb42117-Mar-09 9:23 
QuestionHow to send the ID field of a datalist to another page? Pin
Arroci11-Mar-09 9:17
Arroci11-Mar-09 9:17 
Hi,

I'm an A level student in the UK studying computing. For my project, I have to create a website for a real company. I'm using Visual Web Developer 2008 Express Edition along with MS Access for a database.

I've come across a slight problem which I don't yet have the knowledge for and was wondering if somebody could enlighten me. You see, I have a news page, which uses a datalist which is bound to an MS Access database. This datalist uses a query to display:
- ID (Hidden)
- Heading
- Date published

The database itself also holds the article as a memo in a field. I want to implement a button, which will redirect the user to a page containing the article. My idea was to send the ID of the record from the datalist to another page, and use this information as an integer on the next page for a query, which will select the matching article (matching the article ID to the integer), and present it on the page. Here are the code snippets to help understand better:

News.aspx
<asp:datalist id="DataList1" runat="server" datakeyfield="ID" xmlns:asp="#unknown">
    DataSourceID="NewsDataSource">
    <itemtemplate>
        ID:
        <asp:label id="IDLabel" runat="server" text="<%# Eval("ID") %>" />
        <br />
        Heading:
        <asp:label id="HeadingLabel" runat="server" text="<%# Eval("Heading") %>" />
        <br />
        Published on:
        <asp:label id="Published_onLabel" runat="server">
            Text='<%# Eval("[Published on]") %>' />
        <br />
        <br />
        <asp:button id="GoToArticle" runat="server" onclick="Go_To_Article" text="Read More" commandargument="<%# Bind("ID") %>" />
    </asp:label></itemtemplate>
</asp:datalist>




The Code-behind for News.aspx

'Event to transfer page control to NewsArticle.aspx
Protected Sub Go_To_Article(ByVal sender As Object, ByVal e As EventArgs)
    Dim IDLabel_Value As Integer
    IDLabel_Value = 'here is where I don't know how to select the ID field of datalist1
    Response.Redirect("~/NewsArticle.aspx?IDLabel_Value = " & CStr(IDLabel_Value))

End Sub




And I don't know how to retrieve the ID value send to NewsArticle.aspx Frown | :( I have looked up on a method which uses get property on the first page and then Dim As Result on the second page. But even then, I don't know how to retrieve the ID field of the record from a datalist. Any help would be greatly appriciated.

Thanks!
AnswerRe: How to send the ID field of a datalist to another page? Pin
Christian Graus11-Mar-09 9:33
protectorChristian Graus11-Mar-09 9:33 
AnswerRe: How to send the ID field of a datalist to another page? Pin
Yusuf11-Mar-09 9:50
Yusuf11-Mar-09 9:50 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Christian Graus11-Mar-09 9:54
protectorChristian Graus11-Mar-09 9:54 
AnswerRe: How to send the ID field of a datalist to another page? Pin
Arroci11-Mar-09 11:18
Arroci11-Mar-09 11:18 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Christian Graus11-Mar-09 12:25
protectorChristian Graus11-Mar-09 12:25 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Yusuf11-Mar-09 12:58
Yusuf11-Mar-09 12:58 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Arroci11-Mar-09 13:19
Arroci11-Mar-09 13:19 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Yusuf11-Mar-09 13:48
Yusuf11-Mar-09 13:48 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Arroci11-Mar-09 14:15
Arroci11-Mar-09 14:15 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Yusuf11-Mar-09 15:12
Yusuf11-Mar-09 15:12 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Christian Graus11-Mar-09 15:46
protectorChristian Graus11-Mar-09 15:46 
GeneralRe: How to send the ID field of a datalist to another page? [modified] Pin
Arroci11-Mar-09 18:19
Arroci11-Mar-09 18:19 
GeneralRe: How to send the ID field of a datalist to another page? Pin
Arroci12-Mar-09 10:26
Arroci12-Mar-09 10:26 
QuestionHow to display a jpg on a web page Pin
scjsb11-Mar-09 4:57
scjsb11-Mar-09 4:57 
AnswerRe: How to display a jpg on a web page Pin
Yusuf11-Mar-09 5:20
Yusuf11-Mar-09 5:20 
AnswerRe: How to display a jpg on a web page Pin
Rutvik Dave11-Mar-09 6:08
professionalRutvik Dave11-Mar-09 6:08 
AnswerRe: How to display a jpg on a web page Pin
Cybernate11-Mar-09 6:25
Cybernate11-Mar-09 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.