i got two pages upl.aspx and datalist.aspx
i have got iframe in upl.aspx page which loads datalist.aspx
now i am creating a session on radiobutton click whiich is inside datalist i want to pass this session value to external js file so that now i have a function Hidee() in uploo.aspx page which can show its value
HOW TO DO THIS??
here is my code for up1.aspx
<a onclick="Hidee();" style="cursor: pointer">close</a></div>
<iframe id="frame1" frameborder="0" name="frame1" src="datalist.aspx"></iframe>
this is from datalist.aspx in which i have my datalist
<td align="center" >
<asp:RadioButton ID="rdb" runat="server" CssClass="radio" AutoPostBack="True" OnCheckedChanged="rdb_click" />
<asp:HiddenField ID="HiddenField1" runat="server" Value = '<%#Eval("FileName")%>' />
</td>
</tr>
here is codebehind datalist.cs
public void rdb_click(object sender, EventArgs e)
{
string value = "";
for (int i = 0; i < DataList1.Items.Count; i++)
{
RadioButton rdb1;
rdb1 = (RadioButton)DataList1.Items[i].FindControl("rdb");
if (rdb1 != null)
{
if (rdb1.Checked)
{
HiddenField hf = (HiddenField)DataList1.Items[i].FindControl("HiddenField1");
value = hf.Value.ToString();
}
}
}
Session["Background1"] = value;
Label2.Text = value;
}
and in my external javascript i have function Hidee();
function Hidee()
{
var div2 = document.getElementById( "divframe1" );
div2.style.display = "none";
var div3 = document.getElementById( "aa" );
div3.style.display = "block";
var session ='<%= Session["Background1"] %>';
alert("you have selected" + session);
}