I have to call a function to send some data in onclick method
<div class="yildiz"><asp:ImageButton ID=Imageid runat="server" Height="19px"
ImageUrl="~/images/yildiz.png" onclick= "<%= someFunction('das') %>" Width="20px"
style="position: relative; top: 13px; left:6px; float:left; " /></div>
Use OnClientClick, like so:
ReplyDelete<asp:ImageButton
ID=Imageid runat="server"
Height="19px"
ImageUrl="~/images/yildiz.png"
OnClientClick="someFunction('das')"
Width="20px"
style="position: relative; top: 13px; left:6px; float:left; "
/>
asp.net side
ReplyDelete<div class="yildiz"><asp:ImageButton ID=Imageid runat="server" Height="19px"
ImageUrl="~/images/yildiz.png"
OnClientClick="SomeMethod(<% j%>, <% imageid%>)" Width="20px"
style="position: relative; top: 13px; left:6px; float:left; " />
C# side
public void SomeMethod(int numberOfStar,string imageId)
{
this.baslik2.Text = "dsadsadsa";
this.baslik.Text = "fasfsa";
ImageButton4.ImageUrl = "images/yildiz-secili.png";
ImageButton2.ImageUrl = "images/yildiz-secili.png";
}
also i tried to call javascript function like
<script type="text/javascript">
function SomeMethod(int j, string imageidd){
javascript: window.open("http://www.microsoft.com");
ImageButton2.ImageUrl = "images/yildiz-secili.png";
}
</script>