Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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

C#
<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.

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


Hope for some help :)

-Thanks
Posted
Comments
[no name] 17-Dec-12 10:27am    
Please explain more about what you want to do here?
ZurdoDev 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.

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.NET
<asp:literal id="MyLit" mode="PassThrough"></asp:literal>

C#
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.
 
Share this answer
 
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?
Problem solved.

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

Thanks for the interest and sorry for taking your time.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900