|
Hi all,
I have a data grid in my aspx page and i want to display only 5 record at a time. that i can do with the help of page size. but I want the gridview to move to next page after 30 seconds without any user interection. after all the data has been shown ( at last page ) i want the page to redirect to my home page.
can anyone have an idea?
thanks in advance
|
|
|
|
|
I'm using ASP.net 2.0 with AJAX enabled. Just for you'r information
|
|
|
|
|
hi, I have a dropdownlist which is binded with data from the database i use the sqldatasource, but it is too long as simliar entries are shown. How do I remove duplicate entries in the dropdownlist? please advice. thanks.
|
|
|
|
|
Hi,
You should provide select query with "DISTINCT" funtion in the "SelectCommand" property of your SQLDataSource as following.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Connstring"
SelectCommand="select distinct(ProductID) from Products"></asp:SqlDataSource>
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
hi. it works. thanks a lot. Hope u don mind i ask qns here cos i am a slow learner. i am reading books on asp.net. thanks a lot 4 ur help
|
|
|
|
|
Hello people,
I have a system with a windows application, a web service and a remoting application (on another machine.)
The windows application calls the web service to execute some task. The web service references an assembly that will establish contact with the remoting server to execute the task. Everything works fine but if an exception is thrown by the remoting server, I am not able to propagate it back to the remoting client (web service.)
The error is:
Server encountered an internal error. For more information, turn on customErrors in the server's .config file.
Does "server" here mean the web service or the remoting server? I have added the following lines at the end of the web.config of the web service:
<system.runtime.remoting>>
<debug loadTypes="true" />
<customErrors mode="off" />
</system.runtime.remoting>
I tried both "on" and "off" for the customErrors but nothing works.
To test this issue, I have deliberately sent corrupted data to the remoting server in order to get an exception. I am using .NET 1.1.
In the remoting object method (the one that is called from the web service) I placed a try-catch and displayed the exception in the console (the remoting server is a console app) and I also rethrew a new application exception back. The console writes the correct exception message but it seems that the throw doesn't propagate back the exception message.
I can always get around the problem by adding a flag property and an exception message property in the remoting object. I would then catch the exception in the remoting object, set the flag to false and the message to the exception message and return. Back on the web service, I would test if the flag is false and continue from there.
I would prefer to be able to propagate the exception in a clean manner so if anyone has any clue, I would appreciate it.
Thanks,
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi, I'm atempting to prevent SQL injection by incorporating the function below into my code, but I'm not sure how to change my select statement to make it work. Below is the function I'm intending to use and below it is my code.
function killChars(strWords)
dim badChars
dim newChars
badChars = array("select", "drop", ";", "--", "insert", "delete", "xp_")
newChars = strWords
for i = 0 to uBound(badChars)
newChars = replace(newChars, badChars(i), "")
next
killChars = newChars
end function
Private Sub lblRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblRegister.Click
Dim myConnection As OdbcConnection
Dim myCommand As OdbcCommand
Dim strInsert As String
Dim strSQL As String
strSQL = String.Empty
myConnection = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=myDB;User=myUser; Password=myPW;Option=3;")
strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
myCommand = New OdbcCommand(strSQL, myConnection)
myCommand.CommandType = CommandType.Text
myConnection.Open()
Dim result As Integer = CType(myCommand.ExecuteScalar,Integer)
' If record count > 0, then UserName already exists in the database
If result > 0 Then
lblMessage.Text = "User name already exists in the database"
Else
strInsert = "INSERT into myTable (Password,UserName)values (?,?)"
Dim myCommand1 As OdbcCommand = New OdbcCommand(strInsert, myConnection)
myCommand1.Parameters.Add(new OdbcParameter("@Password", txtPassword.Text))
myCommand1.Parameters.Add(new OdbcParameter("@UserName", txtUserName.Text))
Dim result1 As Integer = myCommand1.ExecuteNonQuery()
End If
'close the connection
myConnection.Close()
End Sub
I don't know how to modify the lines
strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
and
strInsert = "INSERT into myTable (Password,UserName)values (?,?)"
to make the KillChars function work. Any suggestions will be grately appreciated, thank you in advance for your help.
-- modified at 3:07 Wednesday 20th June, 2007
|
|
|
|
|
ASPnoob wrote: I don't know how to modify the line
strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
to make the KillChars function work.
You can use the killChars like this:
strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", killChars(txtUserName.Text))
But you should use killChars to prevent SQL Injection.
The best way you can do this is by using stored procedure.
I would suggest you to read this http://www.codeproject.com/cs/database/SqlInjectionAttacks.asp[^].
Regards,
Arun Kumar.A
|
|
|
|
|
I could be wrong on this but I thought the whole point of using parameters (as you are doing) was to prevent SQL injection, ie ADO.NET would take care of it for you so you wouldn't need your own function.
|
|
|
|
|
|
hi friends
i have textbox .how can i pass another page in textbox value using querystring through javascript
this my javascript snipt
onclick=\"yih_idpop('check.aspx?');
how to add here in my textbox
regards
saravanan
|
|
|
|
|
you can do it in serverside code
Response.Redirect("'check.aspx?QueryString1=" + TextBox1.Text);
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Try with
Response.Redirect("'check.aspx?QueryString1=" + txtBox.Text);
Regards,
Satips.
|
|
|
|
|
Satips wrote: You can't do like this.
Why dude we can pass query string using javascript Whats the problem ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi Sandeep i have corrected it.
Regards,
Satips.
|
|
|
|
|
I thought you were suggesting not to use javascript thats why i asked
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Try This:
Assign the redirect() function to the onClick attribute of the button.
function redirect()
{
document.location.href = "check.aspx?t1=" + document.getElementByID("txtName").Value;
}
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Freind
you can pass the Querystring from javascript in similar you used to pass in server side code
='check.aspx?QueryStringKey=QyerStringValue&QueryStringKey=QueryStringValue
Where QueryStringKey -> Key for query string
QyerStringValue -> Value that you wan to pass
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi this my code
if(oBw.ie5||oBw.ns6){document.write("<div id=\"instructions\" style=\"border: 1px solid #708090; background: #fff8dc; padding:4px; width: 200px;margin 0 0px 0;display:block\" align=\"center\" designtimesp=17632><input class=\"yihbtn\" type=\"button\" name=\"checkAvail\" value=\"Check Availability of UserName\" style=\"width:15em\" onclick=\"yih_idpop ('check.aspx?QueryString1=' + "txtuname.Text");return false;\" target=\"_blank\"></div>");}
it is not working
i dont need response.redirct .already i used in popup window
regards
saravanan
|
|
|
|
|
Yes i did say you to use Response.Redirect you can do it by using javascript
When are this calling this ? Where is the function ?
Only you want open a new window with query String value isn't it ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
i need to pass txtbox value onepage to another pop up window
|
|
|
|
|
Take a look now this should help you
var textBoxText=document.getElementById("TextBox1").value;
window.open('April24.aspx?QueryStrngValue='+textBoxText);
put this code in a function call that function when you want to open a new window
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi
In my application I a have many pages.So I thought of categorise pages to some groups and want to display their groups on the URL before the page name.
Ex:
http://localhost:1255/Website/Products/Pname.aspx
I have to insert Products/ in the URL in between Website and PName.aspx.
I think this can be done using URL Rewriting, but how?
Suggest me with an example.
Thank u
Chandu
|
|
|
|
|
|
Thanx for u r reply.
Do u have any one of ur example, I will start with that.
Thank u
Chandu
|
|
|
|