PDA

View Full Version : refresh کردن صفحه وب



mahdyeh
جمعه 30 مهر 1389, 15:58 عصر
سلام

با vb.net دارم کد مینویسم تحت وب (asp.net)

من یک input Button گذاشتم در صفحه
میخوام وقتی input Button رو کلیک میکنم ( که یسری کارایی انجام میشه ، آخر سر ) صفحه refresh بشه !
;

mmnoody2006
جمعه 30 مهر 1389, 17:16 عصر
خب ریدایرکت کن به همون صفحه دیگه !



response.redirect("somepage")

mahdyeh
جمعه 30 مهر 1389, 17:39 عصر
این کد برای Button از نوع Input

response.redirect("Default.aspx")
به این صورت درمیاد


<script language="javascript" type="text/javascript">

function Submit1_onclick() {
response.redirect("Default.aspx")
}

</script>

این کد اجرا نمیشه
چراااا؟؟؟؟؟؟
چون Button از نوع Input هست
یعنی :


<input id="Submit1" type="submit" value="submit" onclick="return Submit1_onclick()" />

این کد ( همون بالایی ) :

response.redirect("Default2.aspx")
برای Button از نوع asp اجرا میشه هااا


<asp:Button ID="Button1" runat="server" Text="Button" />

( که من لازم ندارم و نمیخوام این رو ) :


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Response.Redirect("Default.aspx")
End Sub

;

BookWorm
جمعه 30 مهر 1389, 18:05 عصر
دوست عزیز یا شما باید sprate file استفاده کنی و یا function جاوا بنویسی .



<script language="JavaScript">
<!--

var sURL = unescape(window.location.pathname);

function doLoad()
{
// the timeout value should be the same as in the "refresh" meta-tag
setTimeout( "refresh()", 2*1000 );
}

function refresh()
{
// This version of the refresh function will cause a new
// entry in the visitor's history. It is provided for
// those browsers that only support JavaScript 1.0.
//
window.location.href = sURL;
}
//-->
</script>

<script language="JavaScript1.1">
<!--
function refresh()
{
// This version does NOT cause an entry in the browser's
// page view history. Most browsers will always retrieve
// the document from the web-server whether it is already
// in the browsers page-cache or not.
//
window.location.replace( sURL );
}
//-->
</script>

<script language="JavaScript1.2">
<!--
function refresh()
{
// This version of the refresh function will be invoked
// for browsers that support JavaScript version 1.2
//

// The argument to the location.reload function determines
// if the browser should retrieve the document from the
// web-server. In our example all we need to do is cause
// the JavaScript block in the document body to be
// re-evaluated. If we needed to pull the document from
// the web-server again (such as where the document contents
// change dynamically) we would pass the argument as 'true'.
//
window.location.reload( false );
}
//-->
</script>
</head>

<!--
Use the "onload" event to start the refresh process.
-->
<body onload="doLoad()">

<script language="JavaScript">
<!--
// we put this here so we can see something change
document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>

Peyman.Gh
جمعه 30 مهر 1389, 18:09 عصر
<script language="javascript" type="text/javascript">
<!--

function Button1_onclick() {
window.location.href("index.aspx");
}
// -->
</script>
</head>
<body>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /><
</body>

alonemm
شنبه 01 آبان 1389, 11:11 صبح
دوست عزیز اگه میشه علت این که از دکمه های خود ASP.NET استفاده نمیکنید چیه؟

اگه شما میخاید از این تکنولوژی بهتر بهره ببرید باید از کنترل های خودش استفاده کنید.
اگر غیر اینه که همون HTML کار کنید.
(فقط در جهت راهنمایی و استفاده بهتر از این تکنولوژی تحت وب گفتم)

موفق باشید.