|
There are no straight forward way of disabling back button. You can try appending
<script>history.forward()</script>
in the firstline of the page as a workaround so that when the page is back pressed, then, the browser would push it forward.
If it helps then rate me
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
i have tried this method as well but once i get the postback on the page and then click the back button, despite all the correct url the page is directed to cannot find server. I have tried this as well.
javascript:window.history.forward(1);
Now i also tried this but of no use.
Bye
|
|
|
|
|
|
dear blue boy i knw how to google
So, plz give me the answer if u knw it
thx
Bye
|
|
|
|
|
Mr.Sam wrote: knw how to google
Why you can't figure out then?!
I Love SQL
|
|
|
|
|
can anybody give me the answer...
plzzz
Bye
|
|
|
|
|
You shouldn't be able to as far as I know. One practice is to prevent the page from caching i.e. In your aspx page:
<%
Response.CacheControl = "no-cache";
Response.AppendHeader("Pragma", "no-cache");
Response.Expires = -1;
Response.Cache.SetNoStore();
%>
Some combination of these commands should stop caching. Then use the pageload event to redirect as necessary.
Good Luck.
|
|
|
|
|
Hi all,
i have developed one asp.net application and set the session timeout for 20 minutes but how i don't know
my session is timed out not correctly
means, it would be timeout in 1 minute, sometimes it take 20 minute, some time it take 10 minute
why it is ?????
please help...
any setting in Web.Config or Global.asax ??
thankx in advance
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
The setting is in web.config, amd set in minutes:
<sessionState
timeout="20"
/>
- but if you're running this locally on XP don't worry about it; IIS on XP has a mind of it's own, and times out whenever it gets bored and feels like it.
It should work correctly on a proper web server.
Fred
|
|
|
|
|
how to append the listitems as a comma seperated string and insert into the database in a single row using asp.net 2.0 I am using vb. I am copying a content of listbox1 to listbox2. I want to store the listbox2 data into database. I am using the following code, But the each value is getting stored in different row of the table. I want them to get stored in a single row.
Dim str As String
If dbconn.State ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In lstselectedemployees.Items
str = "insert into a (soft)values('" & item.Text & "')"
Dim comm As New SqlCommand(str, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
Next
If I use the following code then, only the last item of the list box is getting stored,
Dim str As String
If dbconn.State ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In lstselectedemployees.Items
str = "insert into a (soft)values('" & item.Text & "')"
Next
Dim comm As New SqlCommand(str, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
Chaitra N
|
|
|
|
|
Dim str As String
If dbconn.State ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In lstselectedemployees.Items
STR = STR & "," & item.Text
Next
str2="insert into a (soft)values('" & STR & "')"
Dim comm As New SqlCommand(str2, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
|
|
|
|
|
Thank you JC. This is working, But it store a ',' in the very beginning. How to stop this.
Example, if the items are,
A
B
C
It stores ,A,B,C
Chaitra N
|
|
|
|
|
Oh come on. He's done the hard bit for you. Try doing at least some of it yourself.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Dim str As String = ""<br />
If dbconn.State ConnectionState.Open Then<br />
dbconn.Open()<br />
End If<br />
For Each item As ListItem In lstselectedemployees.Items <br />
if str = "" then<br />
str = item.Text<br />
else<br />
STR = STR & "," & item.Text<br />
end if<br />
Next<br />
str2="insert into a (soft)values('" & STR & "')"<br />
Dim comm As New SqlCommand(str2, dbconn)<br />
Try<br />
comm.ExecuteNonQuery()<br />
Label1.ForeColor = Drawing.Color.Green<br />
Label1.Text = "Success"<br />
Catch ex As Exception<br />
Label1.Text = ex.Message<br />
End Try
Try Bold text
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
Thank u. It is working.
Chaitra N
|
|
|
|
|
Well, if you want me to do all the work, it might help if you rated my reply
hint: use the mid-function
|
|
|
|
|
Thank u JC. I gotta know the code. Your code really helped me.
Chaitra N
|
|
|
|
|
I have one more doubt. This is regarding bindng of listbox.
Let us assume I store A B C D in from listbox2. It stores as A,B,C,D . When i bind the data to listbox it comes as the same. But i want to display each value in different row. How to do this? I tried split function but no use. Here is the code snippet i have used to bind the data to listbox, lstselectedemployees is the listbox.
Dim sql As String = "Select * from A_desktops where assetcode='" & TextBox1.Text & "'"
Dim da As New SqlDataAdapter(sql, dbconn)
Dim ds As New DataSet()
da.Fill(ds, "a_desktops")
lstselectedemployees.DataSource = ds.Tables("a_desktops").DefaultView
lstselectedemployees.SelectedIndex = 0
lstselectedemployees.DataTextField = "swinstalled"
Page.DataBind()
Chaitra N
|
|
|
|
|
First u should convert list items into one string seperated by comm(,) and stored it in a string type variable with concatenation.
and then stored the variable into datbase field.
Use this code for converting
global decalartion
dim i as int
dim st as string
for i=0 to i<=ListBox1.item.count-1
if i<>ListBox1.item.count-1 then
st +=ListBox1.item(i) & ","
else
st +=ListBox1.item(i)
End if
Next
BY Nand
Nand
|
|
|
|
|
I have one more doubt. This is regarding bindng of listbox.
Let us assume I store A B C D in from listbox2. It stores as A,B,C,D . When i bind the data to listbox it comes as the same. But i want to display each value in different row. How to do this? I tried split function but no use. Here is the code snippet i have used to bind the data to listbox, lstselectedemployees is the listbox.
Dim sql As String = "Select * from A_desktops where assetcode='" & TextBox1.Text & "'"
Dim da As New SqlDataAdapter(sql, dbconn)
Dim ds As New DataSet()
da.Fill(ds, "a_desktops")
lstselectedemployees.DataSource = ds.Tables("a_desktops").DefaultView
lstselectedemployees.SelectedIndex = 0
lstselectedemployees.DataTextField = "swinstalled"
Page.DataBind()
Chaitra N
|
|
|
|
|
Learn how to properly post code snippets here at CP.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I would like to learn that, any links to where it is explained?
|
|
|
|
|
Hi,
Not quite sure where to post this, but as it's for an asp page, this seems like the right place.
I'm trying to convert a codeproject project from C# to VB and am coming unstuck with raising events. can anyone tell me where i'm going wrong?
C# code:
public delegate void CaptchaEventHandler();
public partial class CaptchaControl : System.Web.UI.UserControl
public event CaptchaEventHandler Success
{
add { success += value; }
remove { success += null; }
end class
poorly vb code is:
Public Delegate Sub CaptchaEventHandler()
Partial Public Class CaptchaControl
Public Custom Event Success As CaptchaEventHandler
AddHandler(ByVal value As CaptchaEventHandler)
success += value
End AddHandler
RemoveHandler(ByVal value As CaptchaEventHandler)
success += Nothing
End RemoveHandler
End Event
But i just get "missing raiseevent" errors
Many Thanks
|
|
|
|
|
I think it's like this not sure
<br />
Public delegate Sub CaptchaEventHandler()<br />
Public partial Class CaptchaControl<br />
Inherits System.Web.UI.UserControlPublic event CaptchaEventHandler Success<br />
Public delegate Sub CaptchaEventHandler()<br />
Public partial class CaptchaControl : System.Web.UI.UserControlPublic event CaptchaEventHandler Success <br />
<br />
End Class<br />
{<br />
add <br />
{<br />
success += value <br />
}<br />
remove <br />
{<br />
success += Nothing <br />
}<br />
end class
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
Thanks for your reply,
This is not quite right, the c# code works fine, but i want to use VB.
|
|
|
|