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

ASP.NET

 
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 
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 
Thanks christian and yusuf for the help. I've never tried to post using a query; I gave it a shot but now I get the following error when clicking on the button:

System.NullReferenceException: Object reference not set to an instance of an object.

for line



Response.Redirect("~/NewsArticle.aspx?ID=" + this.IDLabel.Text);


I'm not sure, but I think it may have something to do with the fact that i've used
<asp:label id="IDLabel" runat="server" text="<%# Eval("ID") %>" xmlns:asp="#unknown" />

here (if xmlns:asp="#unknown" shows up that's really not there...it just shows up in the preview :P). So here is the overall code behind:

public partial class News : System.Web.UI.Page
{
    protected System.Web.UI.WebControls.Label IDLabel;
    protected System.Web.UI.WebControls.Button GoToArticle;
	
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void Go_To_Article(object sender, System.EventArgs e)
    {

        Response.Redirect("~/NewsArticle.aspx?ID=" + this.IDLabel.Text);
    } 
}


I had followed the tutorial yusuf kindly linked me (and thank you for it ^_^), but i noticed in the source code, the author is using <form method="post"></form>, whereas I can't put a form in my news.aspx page because I've already implemented one in the master page. This has proven to be one hell of a coursework!

Thanks.
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 
QuestionI need some direction on a web page Pin
Tom Wright11-Mar-09 4:36
Tom Wright11-Mar-09 4:36 
AnswerRe: I need some direction on a web page Pin
Yusuf11-Mar-09 5:22
Yusuf11-Mar-09 5:22 
GeneralRe: I need some direction on a web page Pin
Tom Wright11-Mar-09 6:04
Tom Wright11-Mar-09 6:04 
GeneralRe: I need some direction on a web page Pin
Cybernate11-Mar-09 6:26
Cybernate11-Mar-09 6:26 

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.