In one of the webiste I have seen something like this to call C# function
from Javascript :
--------------------------------------------------------
<script language="javascript">
function init()
{
alert('hello ');
<%SetData();%>; //------------------------------> main line
alert('<%=strName%>');
}
</script>
-------------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
this.ImageButton1.Attributes.Add("onclick",
"javascript:init();");
}
}
public void SetData()
{
strName = "mainpico";
}
But when I try to replicate the same .. I'm getting error in the main line.
How can I achieve the same?
"Mohamoss" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Steven
> C# is complied language not just interpreted script language as
> JavaScript
> Therefore, i don't think you can do that , the opossite is easy however.
> Mohamed M .Mahfouz
> Developer Support Engineer
> ITWorx on behalf of Microsoft EMEA GTSC
>
|