Click here to Skip to main content
12,403,811 members (68,303 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Hi,

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 | :)

-Thanks
Posted 17-Dec-12 3:18am
Comments
ryanb31 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 17-Dec-12 14:25pm
   
the embed area
<pre>
<embed src="/Programblade/<%: DropDownList1.SelectedValue.ToString() %>" width="750" height="550">
</pre>

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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Comments
Junker91 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 17-Dec-12 15:59pm
   
what part is giving you problems?
did you read up on literals and how they work?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Problem solved.

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

Thanks for the interest and sorry for taking your time.
  Permalink  
Comments
Adam R Harris 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2016
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