|
<script language="javascript" type="text/javascript">
function confirmation()
{
return window.confirm("Are sure u want to redirect");
}
</script>
If (Not Page.IsPostBack) Then
Button1.Attributes.Add("onclick", "javascript:return confirmation();")
End If
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("archana.aspx")
End Sub
Sonia Gupta
Soniagupta1@yahoo.co.in
|
|
|
|
|
I am not sure what programming language and what version of .net you are looking for. Here is an example in vb.net for .net 1.1
Private Sub ShowMessageBox(ByVal aMessage As String)
'This procedure will cause a dialog box to pop up with whatever message is passed in.
aMessage = aMessage.Replace(vbCrLf, "\n").Replace("""", "'")
Dim myScript As New StringBuilder
With myScript
.Append("<script>")
.Append(Environment.NewLine)
.Append("alert(""").Append(aMessage).Append(""");")
.Append(Environment.NewLine)
.Append("</script>")
Page.RegisterStartupScript("Promo Error", .ToString())
End With
End Sub
It is slightly different for .net 2.0 and the syntax is a little different for C#.
Hope that helps.
Ben
|
|
|
|
|
Thanks for all ur Replies. I will check your suggestions,
Im using dotnet2005 i.e version2.0 and vb.net as codebehind
|
|
|
|
|
In that case the code is slightly different:
Private Sub ShowMessageBox(ByVal aMessage As String)
'This procedure will cause a dialog box to pop up with whatever message is passed in.
aMessage = aMessage.Replace(vbCrLf, "\n").Replace("""", "'")
Dim myScript As New StringBuilder
With myScript
.Append("<script>")
.Append(Environment.NewLine)
.Append("alert(""").Append(aMessage).Append(""");")
.Append(Environment.NewLine)
.Append("</script>")
ClientScript.RegisterStartupScript(Me.GetType(), "Promo Error", .ToString())
End With
End Sub
Ben
|
|
|
|
|
is there any event that fires up when the web for is closed?
Sonia Gupta
Soniagupta1@yahoo.co.in
|
|
|
|
|
|
Hello Ben......
is there any other way out to check whether the fom is closing...
Sonia Gupta
Soniagupta1@yahoo.co.in
|
|
|
|
|
You can track browser close event
|
|
|
|
|
There are some things you can do with javascript, but nothing works all the time. I would guess you aren't interested in javascript you want something to happen on the server side like expire a session or something like that. There really isn't any good way of doing it. If you do a google search on browser closing event you will see some discussions on this and what other people have tried.
Ben
|
|
|
|
|
You must know the the life cycle of web from . It is stateless so is that possible to close web from . just u close the explore. The last event of web form is dispose. Ok .
Devjit
|
|
|
|
|
|
you can catch that event only using javascript.
All The Best
Sathesh Pandian
|
|
|
|
|
Hi,
Im a bit rusty with .Net so forgive my ignoarance.
I need the easiest (minimal code) way to count the number of records returned by a SqlDataSource (SQL2005). This can be either with a DataSet or a Reader.
Thanks
|
|
|
|
|
|
Hi i am displaying my records in datagrid...,
In that one month data's are displaying with the date...,
Now,Except those dates anyother date will be there in that month...,
It also want to show...,
Example:
june month have 30 days...,
But in my table,i have 1 to 22 date and 25 to 30 date records...,
It will be display using query...,
Remaining 23 to 24 dates also want to show in that datagrid ...,
How to do that...,
Plz tell me...,
-- modified at 7:28 Friday 6th July, 2007
Magesh
|
|
|
|
|
Just u have to write sql query that if the day has no any record that day should have blank record. that will solve your problem.
Devjit
|
|
|
|
|
I hope this time i will get the solution for this probs...,
I am trying to display my datagrid bound column cell value in datagrid textbox place...,
So i used this following code...,
For Each fillgrdregtextbox As DataGridItem In dgrdmain1.Items
Dim AppRgHrs As TextBox = CType(fillgrdregtextbox.FindControl("txtAppRgHrs"), TextBox)
Dim AppOtHrs As TextBox = CType(fillgrdregtextbox.FindControl("txtAppOtHrs"), TextBox)
If fillgrdregtextbox.Cells(25).Text <> "" Then
AppRgHrs.Text = Val(fillgrdregtextbox.Cells(25).Text)
AppOtHrs.Text = Val(fillgrdregtextbox.Cells(26).Text)
ElseIf fillgrdregtextbox.Cells(27).Text <> "" Then
AppRgHrs.Text = Val(fillgrdregtextbox.Cells(27).Text)
AppOtHrs.Text = Val(fillgrdregtextbox.Cells(28).Text)Else
AppRgHrs.Text = 0
AppOtHrs.Text = 0
End If
Next
In this that first if condition is working...,
But that elseif is not working...,
Instead of that i am getting 0 on there...,
If its not possible plz tell me some other way to do that...,
Advance thanks...,
-- modified at 7:24 Friday 6th July, 2007
-- modified at 7:25 Friday 6th July, 2007
Regards,
Magi
|
|
|
|
|
please correct your subject
Regards,
Satips.
|
|
|
|
|
Check out your nulldisplaytext property of the bound column.Could be problem occure for this.
Devjit
|
|
|
|
|
Ya i checd those cells it are empty only...,
But not getting proper answer...,
Regards,
Magi
|
|
|
|
|
I am using the following code to export data from datagrid to excel. but I am geting the error in dgresult.rows which says. what is the reason for this.
Error 20 'rows' is not a member of 'System.Web.UI.WebControls.DataGrid'
Private Sub ExportGridToExcel()
Dim Excel As Object = CreateObject("Excel.Application")
If Excel Is Nothing Then
MsgBox("Excel is not installed on this machine. This operation requires MS Excel to be installed on this machine.", MsgBoxStyle.Critical)
Return
End If
'Make Excel visible
Excel.Visible = True
'Initialize Excel Sheet
With Excel
.SheetsInNewWorkbook = 1
.Workbooks.Add()
.Worksheets(1).Select()
'Add header row to Excel Sheet by copying column headers from the Datagrid
Dim Col As DataGridViewColumn
Dim i As Integer = 1
For Each Col In dgresult.Columns
.Cells(1, i).Value = Col.HeaderText
i += 1
Next
'Add data to excel sheet by looping through the rows in the datagrid
i = 2
Dim RowItem As DataGridViewRow
Dim Cell As DataGridViewCell
For Each RowItem In dgresult.rows
Dim j As Integer = 1
For Each Cell In RowItem.Cells
.Cells(i, j).Value = Cell.Value
j += 1
Next
i += 1
Next
End With
Excel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel)
Excel = Nothing
MsgBox("Export to Excel Complete", MsgBoxStyle.Information)
End Sub
Chaitra N
|
|
|
|
|
With the datagrid on the web it is items not rows. It is different then the windows datagrid.
sample from microsoft help:
Dim item As DataGridItem
For Each item In ItemsGrid.Items
Label1.Text &= "<br>" & item.Cells(0).Text & _
" " & item.Cells(1).Text & _
" " & item.Cells(2).Text
Next item
Ben
|
|
|
|
|
Hi All
I am having a master page contains dropdownlist to select the language.
when write the following method just below the
public partial class Sign_in : System.Web.UI.MasterPage<br />
{<br />
protected override void InitializeCulture()<br />
{<br />
string culture = Request.Form["cmbCulture"];<br />
if (string.IsNullOrEmpty(culture))<br />
culture = "Auto";<br />
UICulture = culture;<br />
Culture = culture;<br />
if (culture != "Auto")<br />
{<br />
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(culture);<br />
System.Threading.Thread.CurrentThread.CurrentCulture = ci;<br />
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;<br />
}<br />
<br />
base.InitializeCulture();<br />
}<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{}<br />
<br />
}<br />
following error occur only with he master page:
'Sign_in.InitializeCulture()': no suitable method found to override
while same process is working in aspx page.
Thanks in advance..
Regards,
Sri..
|
|
|
|
|
how to code to rate forum in asp.net using c# and its design.
harika
|
|
|
|
|
we cannot do your homework.
Regards,
Satips.
|
|
|
|