Click here to Skip to main content
11,496,146 members (390 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C#

I am new at this, but i try to explain.

<embed src="/Programblade/<%: DropDownList1.SelectedValue.ToString()  %>" width="750" height="550">

And it works really fine(because i have choosen an default selected item, but here is the problem.

I want it to refresh that area, when the selectedindexchanged, i tried a lot, and search the web, but could not find what i was looking for.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            What should i write here???? to refresh the other code?

Hope for some help Smile | :)

Posted 17-Dec-12 4:18am
ryanb31 at 17-Dec-12 10:36am
It all depends on what code you have. What do you want to refresh? A grid? An area? Just write code to do whatever it is you want. We don't know specifically what you want or what your code looks like.
Junker91 at 17-Dec-12 14:25pm
the embed area
<embed src="/Programblade/<%: DropDownList1.SelectedValue.ToString() %>" width="750" height="550">

would i like to refresh or update when you pick another data from my dropdown list. so it's another file that is embed. the value of my dropdown items, is fx. programblad 83.pdf. So it is the file I change.
Instead of writing out your embed tag and then inserting the actual file name you should look at using a Literal[^] and then just output the desired embed tag to the Text property and set the Mode to PassThrough.

So something like this:
    <asp:literal id="MyLit" mode="PassThrough"></asp:literal>
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    if (!string.IsNullOrEmpty(DropDownList1.SelectedValue){
       myLit.Text = "<embed src="\"/Programblade/\"" dropdownlist1.selectedvalue="" width="\"750\"" height="\"550\""></embed>";

Please note this was written directly into the browser so it probably wont compile.
Junker91 at 17-Dec-12 15:36pm
I cannot get it to work, i do not understand.
Is it not possible to just make some code, for reload the embed code, so it gets the selectedValue once again, when it has now changed?
Adam R Harris at 17-Dec-12 15:59pm
what part is giving you problems?
did you read up on literals and how they work?
Problem solved.

I haven't checked AutoPostBack on the dropdown that solved the problem.

Thanks for the interest and sorry for taking your time.
Adam R Harris at 17-Dec-12 16:02pm
No problem, if my solution helped please mark it as the accepted solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100