PDA

View Full Version : سوال: فراخوانی تابع جاوا اسکریپت به وسیله کدهای ی شارپ



mahdidabaghi
سه شنبه 09 آبان 1391, 11:27 صبح
باز هم سلام
ایا میشه یک تابعی رو که در قسمت کدهای جاوا اسکریپت نوشتم رو به وسیله کدهای سی شارپ فراخونی کنم؟
ممنون از اساتید

fakhravari
سه شنبه 09 آبان 1391, 11:59 صبح
yes

<script language="javascript" type="text/javascript">
function t2() {
if (confirm("2 جداول تغیرات داشته است"))
window.location.href = "WebForm2.aspx";
}

function t1() {
if (confirm("1 جداول تغیرات داشته است"))
window.location.href = "WebForm2.aspx";
}
</script>
public static void CodeBehin_Script(string function, Page ThisPage)
{
ThisPage.ClientScript.RegisterStartupScript(ThisPa ge.GetType(), "msg", function, true);
}
CodeBehin_Script("t1()", this);

ahmad156
سه شنبه 09 آبان 1391, 12:00 عصر
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "yourFunction();", True)