|
What on earth posesses you to think that we should do your test for you?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
The forum is intended for troubleshooting assistance and not to supplant regular homework. Read the forum guidelines here http://www.codeproject.com/kb/scrapbook/forumguidelines.aspx[^]
Posting questions of this level of stupidity just makes you look like a rude jackass.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hi
How would i put a string value where the number 5 is?
if (dtlogtime.AddMinutes(5) < DateTime.Now)
tried searching couldn't find anything
thanks!!
|
|
|
|
|
if (dtlogtime.AddMinutes(Convert.ToInt32(stringValue)) < DateTime.Now)
|
|
|
|
|
Hu
I have the following code
How can I put this as a hyperlink i.e. <ahref etc<br="" mode="hold">
I dont want a button showing just a bit of text as the hyperlink
thanks
|
|
|
|
|
<asp:hyperlink navigateurl="~/.aspx" visible="false" id="hlrefresh" runat="server" text="Refresh" onclick="javascript:location.reload()">Refresh
|
|
|
|
|
You don't need to create server control just to call a client-side method.
<input onclick="javascript:location.reload();" type="button" title="Reset" />
only two letters away from being an asset
|
|
|
|
|
i think you can do that in plain HTML
Refresh
<a onclick="location.reload();" href="#" title="Refresh">Refresh</a>
Regards
|
|
|
|
|
i wanted to control it throguh the c# though i.e. make it invisible
|
|
|
|
|
Hi all,
I am using asp.net2.0 , C#.
I would like to know which is the best approach(faster ) to fill dopdownlist
1. making stored procedure and filling data to dropdownlist using datareader
2. passing query and filling data to dropdownlist using datareader
As I am facing problem of slowness of filling data . if you find any better approach or faster approach please guide me. database is not much heavy
Method I used to fill dropdownlist is
<br />
public void FillctrlList2(DropDownList ctrl, string procedurename,string fieldtext ,string fieldvalue , string conn, SqlCommand cmd, int i)<br />
{<br />
<br />
try<br />
{<br />
if (con == null)<br />
{<br />
this.openconnection(conn);<br />
this.con.Open();
<br />
}<br />
if (con.State == ConnectionState.Closed)<br />
{<br />
this.openconnection(conn);<br />
con.Open();<br />
}<br />
ctrl.Items.Clear();<br />
ctrl.Items.Add(new ListItem("Select One", "0" ));<br />
cmd.Connection = con;<br />
cmd.CommandText = procedurename;<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
<br />
rdr = cmd.ExecuteReader();<br />
<br />
ctrl.DataSource = rdr;<br />
ctrl.DataTextField = fieldtext;<br />
ctrl.DataValueField = fieldvalue;<br />
ctrl.DataBind();<br />
<br />
rdr.Close(); <br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
<br />
}<br />
}<br />
<br />
regards
imran khan
|
|
|
|
|
There is nothing in that code that would make it slow in any way.
You might make it slightly faster if you loop through the data reader youself instead of using data binding, but not enough to make it noticable unless you are putting thousands of items in the dropdown.
If you really have that many items in a dropdown list, the problem is not the performance of the code, but that you have to rethink your user interface.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: You might make it slightly faster if you loop through the data reader youself instead of using data binding,
Databinding uses the IEnumerator interface to iterate through each item. When we loop through the DataReader , I guess the same thing is happening. So how this can boost the performance ? Please correct me.
|
|
|
|
|
The data binding adds a bit of overhead because it can use many different kinds of data sources. You can improve on this slightly as you can write code specificly for the data source and for the data that it contains.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
catch (Exception ex)
{
throw ex;
}
Please change that portion to:
catch (Exception ex)
{
throw;
}
By doing it your way, you lose the stack trace and it can be harder to debug future problems. And maybe you actually want to do something in that catch other than rethrowing the error? If not, what's the point of catching it in the first place?
I know this doesn't have anything to do with your problem as I don't see anything wrong with your databinding. So unless you're binding a large set of data like Guffa mentioned, this should work fine.
|
|
|
|
|
Using ASP.Net site manageer in VS 2005, membership is integrated into the SQLServer db, not the Express one.
I have the main folder set to allow all users, to allow default.aspx to show.
Then I have subfolders set to deny all users.
Then I have those subfolders allow a role.
On the default.aspx screen I show Loginview indicating your login status.
Project is published to server.
On local machine, rules work. User clicks on link, demands login for page access.
On server rules are ignored, goes right to page.
Any ideas where to look for the problem?
ps. In the site admin tool, I created a user, then checked the db on the server. It is there, so I'm not editing a local db.
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."
|
|
|
|
|
Let me know how to hide the "__do javascript postback" in the bottom of the browser.
it occurs when the user clicks link button or button control and so on
Gopinath.R
|
|
|
|
|
what do you mean hide it? what in the code or the actual button?
|
|
|
|
|
vingo_mail wrote: how to hide the "__do javascript postback" in the bottom of the browser
Try having a attribute like onMouseOver and have a friendly value for window.status='' . This function appears mostly for controls that postback like LinkButton and ImageButtons.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
When ever i call asp.net button it will do what are the code inside the button. after refresh that page automatically button event call once again run the button event. How can i avoid this problem?
Thanks,
Nagraj.
|
|
|
|
|
if (Page.IsPostBack == true) etc
hope this helps
|
|
|
|
|
CODE HORROR!
if (Page.IsPostBack)
{
//do stuff
}
Please don't evaluate a bool to a bool, it's not needed.
|
|
|
|
|
ChrisKo wrote: CODE HORROR!
Why? There is nothing wrong with if(Page.IsPostBack == true ), this documents the intent of the code more explicitly. You could also make the argue that Page is unnecessary.
only two letters away from being an asset
|
|
|
|
|
You are doing an unnecessary comparison that can be easily avoided. I haven't actually looked at the IL, but the compiler might be smart enough to ignore that comparison. That is not the main reason for avoiding that type of code though.
The main reason is because it's quiet easy to do this by mistake:
if(Page.IsPostBack = true )
And then you've got things happening that you never expected and it's easy to miss this simple istype for hours.
I agree that Page could be omitted, but as you mentioned, it makes the code more explicit in intent. It's possible that someone new to ASP.NET development takes over maintenance on this project and doesn't know that the Page object is available to him.
I guess I shouldn't have said code horror, but it's something that should be avoided.
|
|
|
|
|
I have a textbox with initial text that I use as a hint for the user.
I want to clear this text once the user click inside the textbox to enter his own text.
But, I was surprised that there is no handler to the click or focus events of the textbox. So, where can I call my code
Mohamed Gouda
Egypt
|
|
|
|
|
Not really an ASP.NET question, but
http://msconline.maconstate.edu/Tutorials/JSDHTML/JSDHTML03/jsdhtml03-02.htm[^]
You're wrong, there is indeed a focus event on a textbox. Perhaps the issue is that you're looking at the server side events that are shown to you by intellisense, when you really want javascript client side events ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|