Jump to content

Extremely simple question. I should know this...


Austin8159

Recommended Posts

as i understood, you have a file comic.aspxwhen the query string is comic.aspx?num=1 somewhere in its content will show e.g. 1.jpgcomic.aspx?num=2 --> 2.jpg and so on...i don't know anything at all in asp.net so wait a little, someone else would help you :)

Link to comment
Share on other sites

as i understood, you have a file comic.aspxwhen the query string is comic.aspx?num=1 somewhere in its content will show e.g. 1.jpgcomic.aspx?num=2 --> 2.jpg and so on...
If that's the case, something like this could work:
protected void Page_Load(object sender, EventArgs e){    int num;    string imagePath = String.Empty;    if(Request["num"] != null)    {        int.TryParse(Request["num"], out num);    }    switch(num)    {        case 1:            // num was equal to 1            imagePath = "somevalue.jpg";            break;        case 2:            // num was equal to 2            imagePath = "someothervalue.jpg";            break;        case 0:        default:            imagePath = "default.jpg";            break;    }    // if you had <img id="myImage" runat="server" alt="" />    // in your page, you could use this to set the src.    myImage.Src = imagePath;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...