|
thanks, but i want give a url for window.open not the name of form and i want send a querystring. what should i do?
give me a code that doing this work:
this.Page.Response.Redirect(url + "?queryString=" + strSelect);
|
|
|
|
|
Try this.
String stringURL = url + "?queryString=" + strSelect;
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "openWindow", "window.open('" + stringURL + "')", true);
Here I assume that you have two string variables url and strSelect;
|
|
|
|
|
Try this javascript function
<script type="text/javascript">
function myfunction(str1)
{
window.location.href='Default2.aspx?id='+str1;
}
</script>
Regards,
Karthik K...
|
|
|
|
|
I use the following code to get HTML source of a url , but there is a problem!!!
public string Gethtmlsourcecode(string url)
{
WebResponse response = null;
WebRequest request = WebRequest.Create(url);
response = request.GetResponse();
string data = "";
if ((response is HttpWebResponse && ((HttpWebResponse)response).StatusCode.ToString() == "OK") ||
response is FileWebResponse)
{
StreamReader sr = new StreamReader(response.GetResponseStream());
data = sr.ReadToEnd();
}
return data;
}
whith this code for url : http://sme.ir/?p=product.profile&ProductID=53834[^]
part of data which is an html source of the url should be
<tr>
<td class="l lf" width="35%">نام:</td>
<td class="r rf">
آماده سازی و بسته بندی قهوه-كاكائو-چای كیسه ای
</td>
</tr>
<tr>
<td class="l lf">نام قانونی:</td>
<td class="r rf">
<a href='http://parstalat.sme.ir'>پارس طلعت</a>
</td>
</tr>
but data is
<tr>
<td class="l lf" width="35%">نام:</td>
<td class="r rf">
</td>
</tr>
<tr>
<td class="l lf">نام قانونی:</td>
<td class="r rf">
<a href='http://.sme.ir'></a>
</td>
</tr>
you can see some part of HTML source code is not in data!! what should i do to solve this problem?!!!
|
|
|
|
|
Hi all,
In my Web Application, when I am filling a DataSet its giving following error. Regarding this I have searched in Forum. But they told about Command Object timeout property. But I am using Data Adapter.
Error : 'Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding'
My Code is :
Public Sub FillDS(ByVal ds As DataSet, ByVal TblName As String, ByVal Qry As String)
If Not ds.Tables(TblName) Is Nothing Then ds.Tables(TblName).Clear()
DA = New SqlDataAdapter(Qry, Con)
DA.Fill(ds, TblName)
End Sub
Please help me out..
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
You need to set this property:
DA.SelectCommand.CommandTimeout
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thanks for your reply Manas, But
Its not working... Earlier it was waiting for 30 sec. and giving TimeOut Expired. Now it is waiting for 1 minute 30 Sec. But same error is coming...
Error :
Sys.WebForms.PageRequestManagerTimeOutException: The Server request timed out.
Please reply me...
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
This error can be coming due to Connection Pooling in the database server. When you open a connection in your code, check whether you properly closed that connection.
Check sp_who(if it is SQL Server) to see the number of connection opened in the database.
|
|
|
|
|
I develop an application Vehicle Management.while opening a page contains tabcontainer ,its not displaying in Mozilla but if u refresh it will be displayed.
any one can help for this ?
Thanks
|
|
|
|
|
Maite, I assume no one here is in business of guessing.
Would you mind to post your code so that we can look at it.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello Everyone........I am developing a shopping cart website......and for cart i m making data table dynamically.Whenever User goes to view the cart. I am showing the Cart Items in a Data List. In this i added to main Funcationalities Remove Item and Update Qunatity.For Update Quantity I added a TextBox to show and edit values. I am able Remove Item but not able to edit Product Quantity in data table dyanmically....Plz Guide me....
|
|
|
|
|
Hi al,
I am using asp login control.If i enter special characters like < ; ! it throws server error. How to over come this. Can we validate the asp login control??
|
|
|
|
|
You can do this by any of these ways:
1. Check the user name and password entered for special characters in the LoggingIn event of the Login control.
2. Place a validator (RegularExpression or Custom as per your need) and set its ControlToValidate property as the user name and the password text box. You can find the ClientID of them through FindControl.
3. Use LayoutTemplate to customize the Login control as per your need.
|
|
|
|
|
In my Visual 2005 ASP.NET project I would like to break up my _Default C# code behind file into multiple .aspx.cs code files. Can I do that? How do I do that?
I would like to declare _Default partial classes in multiple code files.
Normally in a windows app I could just declare the same class as a partial class in multiple files. However, when I try this in ASP.NET I get a conflict error at compile time.
Thanks!
Mark
|
|
|
|
|
I've never seen this done in ASP.NET. Perhaps you can break some functionality into a different class and have your page class carry an instance ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
mjc225 wrote: OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>=StartDateExport) AND EventEndDate>=#12/1/2009#", cn); //This doesn't work.
Of course it doesn't. You're missing something pretty basic. When you put something in quotes, it's a literal. You're passing the word StartDateExport, instead of passing the value of the variable of the same name.
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>= " + StartDateExport + ") AND EventEndDate>=#12/1/2009#", cn);
If you don't understand how to concatenate strings, I'd suggest you should work through a basic C# book before going further.
Depending on where your dates come from, it's possible you will have a massive security hole in your site, due to SQL injection attacks. In any case, for you to put this in your page load is terrible design ( really, it's no design at all ). If you're teaching yourself or doing a class, it's probably fine, but if anyone is paying for this code then they are paying too much.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
public int LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
return cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
after this Function raises Error
DataBinding: 'System.Int32' does not contain a property with the name 'ID'.
what's the problem?
C# Developer
|
|
|
|
|
West1989 wrote: try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
return cmd.ExecuteNonQuery();
}
You are doing wrong here. You are trying to execute Stored procedure ?
Look at this
public int LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText="GetBooksByCategory";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("@ID", categoriID));
return cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
Hope this will help you
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
West1989 wrote: cmd.Parameters.Add(new SqlParameter("ID", categoriID));
Change ID to @ID here and try
Cheers!!
Brij
|
|
|
|
|
but there is same error
DataBinding: 'System.Int32' does not contain a property with the name 'ID'.
look
public void LoadByCategories(int categoriID)
{
Connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "exec GetBooksByCategory @ID";
cmd.Connection = Connection;
cmd.Parameters.Add(new SqlParameter("ID", categoriID));
cmd.ExecuteNonQuery();
}
finally
{
Connection.Close();
}
}
it warks, there is problem with return type, but i can not understand it
C# Developer
|
|
|
|
|
Did you check my code? I didn't see any change in your current code? Please check my first post.
Thanks !!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Abhijit Jana
Yes, I checked it but as I said there is same error
C# Developer
|
|
|
|
|
Well, the code you posted is different to the code he gave you, so why did you post that ?
What line gives the error ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
West1989 wrote: cmd.Parameters.Add(new SqlParameter("ID", categoriID));
Change with
cmd.Parameters.AddWithValue("@ID", categoriID);
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|