Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I'm confused, are you wanting to record the date of the registration within the information you're recording about the registration? Or in a separate record/table?

If you simply want the current date/time within the same record it's as simple as adding a date/time column in your table and populating it either from the code-behind side with DateTime.Now or on the SQL side with (I think) dateTime.Now() (been a while since I used the commands directly within SQL).

AngelicOne commented: thanks +1
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Short version, you have a form text field that is trying to pass script directly via your code-behind.

Example:
TextBox contains <a href="http://yourURL.com/">
TextBox contains <script="scriptHere">

Some server configurations prevent passing scripts from forms via code-behind as a security precaution.

Option 1: Disable this security precaution ("<%@ Page EnableEventValidation="true" %> in a page") Not a good option as it opens up many security holes in your application/site
Option 2: Provide alternate text modification methods (such as [ B][ /B]) that are handled at the code-behind level to convert the text to html equivalents so that html code is not being passed from the textbox/source and disable (possibly via RegEx) script from being entered into your textbox/source. Difficult (but not impossible) to code
Option 3: "use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation" simpler to code but still opens possible security issues in your code/site if not handled correctly

Hope this helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

One possible method would be to set a variable attached to the user's session that records the current time every time an action is carried out.

The only drawback there is that you would need something (like a timer) which would periodically check against that variable and against the current time to validate your timeout period having passed or not. Basically though, if you set a timer for say 10 minutes in length to start when an action is carried out, and at the same time set a variable to contain the current time... when the timer runs out it checks current vs stored and if > your timeout period will end the session.

If, on the other hand, a new action is carried out in the meantime, the timer and the stored time are reset and the session is maintained.

Hope this helps :) Please remember to mark solved once your issue is resolved. Also, it may have been better to have posted this question in the same thread you'd already started relating to timed session expiration :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

pipped at the post...great minds and all that :p

Haha no doubt :twisted: if not for minor format variations I'd swear we were reading each other's minds when we wrote those.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

That link if for a DataGrid and will not apply to the DGV.

My bad, must not have been paying attention when I looked it up :twisted: Liking your example though, very thorough and should work well as long as they follow the steps (and know how to follow the steps) :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

1) Please use (code) tags to enclose your code segments as it makes them much easier to read :)
2) Judging by "ConfigurationManager.ConnectionStrings" this should be in ASP.Net

Now then...

You can approach it one of two ways...

Change your code to reflect this:

if (reader.HasRows)
{
    reader.Close();

    this.gvwregioncategory.DataSource = cmd.ExecuteReader();

    this.gvwregioncategory.DataBind();
}

or to this:

if (reader.HasRows)
{

    this.gvwregioncategory.DataSource = reader;

    this.gvwregioncategory.DataBind();
}

The way you have it currently = cmd.ExecuteReader(); occurs both outside and inside your try/catch/finally segment effectively opening the reader twice causing your error.

Hope that helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Honestly ardav, it's really not so much of an issue for me (the actual solved count). As I said in one of my earlier replies that part is more just me wanting to feel all super and stuff :icon_twisted:

My primary motivation for wanting the "vote to solve" thing as I mentioned earlier is more so that people can actually see that a thread is solved as one more indicator that there's no further need to add to it or further need to investigate on behalf of the original poster.

If I was truly concerned only with my solved count and reputation and not with actually just being there to help others then I would've stopped posting when I saw how (realistically) useless those stats were and I wouldn't be sitting at ~500 posts (mostly in reply to other peoples' questions) in under a month :twisted:

Right about now, at least until I find myself some gainful employment, I've really got little else to do with my day than to put my knowledge to productive use trying to help others when and where I can :) Though I hope to be as helpful once I find work in whatever time remains to my day at that point.

*shrug* I'm not even sure why I brought it up in the first place though as it'd likely be as much of a pain to implement as the original concept that this thread started with anyway lol.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I'll toss you an example from your own solved list:

You all took part in the same thread at different points in the conversation prior to it being marked solved and it shows up in all your solved lists.

Edit: On a side note, you only get credit towards the thread, not all the posts you contributed to it, so even though you have 30 posts within "solved" threads you only get credit for the 15 actual threads.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

DataSet

C# (as with most languages) is case sensitive :twisted:

Hope that helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Defined session states (or equivalents) can add more direct control on the part of the coding that you implement but are not necessary for most day-to-day implementations of ASP.Net per-se.

Beyond that, I'll leave it to others more expert than I am to offer opinions on the importance (or lack of) of session state control and any scenarios where it might be more important than others.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

But I think only the last poster after whom the thread was marked solved gets the credit.

No, AD is correct... If you post (as long as you're not the original poster) within a thread that is subsequently marked as 'solved' all posters in that thread get credit towards the 'solved' status.

It may not have been that way in the past but it has been at least since I joined about a month ago.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

True, but I like to FEEL like I'm the super-solver-of-all-problems!! :P

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

This would be one of those "yes... and no" type situations.

Yes, each person accessing the site would basically get their own 'session' in their interactions with the site. However... (and that's a strong word, however)... This is in large part affected by the methods and practices used in developing your code-behind components.

At the basic level, variables and passed information will relate to the session of the person who initiated them unless programmed otherwise. However, without specifically taking session states into account there are areas where this can go wrong and potentially cross populate information if mis-coded.

Hope that helps :) Please remember to mark as solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

am I the only one that uses www.msdn.com?

Nope, I refer people there all the time in the C# and ASP.Net forums :icon_twisted: Granted I use the http://msdn.microsoft.com entry point as opposed to the UK entry point you posted but same difference.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Thanks folks :) The links aren't just bein' tossed out for nothing, they're dutifully making their way into my bookmarks :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Ok, I'd like to reiterate my earlier point about having some sort of 'vote to solve' option! :icon_twisted:

It's very frustrating seeing my solved count go up slowly when about 2x as many threads have actually been solved but 1-2 post newbies refuse to come back and mark the thread solved after getting the answer they needed.

Oh and Ardav, I'm not quite at godlike status yet... but with ~1/3 of my posts directly associated to solved threads and another 1/3 associated to threads that should be marked solved... And about 1/5 of my posts related to personally started threads (discussions and questions alike)... Ya, I'm getting there :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Last I checked the only things affected by regional differences in technology these days were DvDs because players in different regions can be hard-coded to not play certain format types. This generally comes into play in certain nations that won't be mentioned here where they don't want certain types of video content (or more specifically content from certain countries) to be viewable by their populace.

Another interpretation of the cause and use of region coding is explained here.

As for software there really hasn't been any region specific encoding involved in software other than perhaps in the interface language(s) supported for the software so a software that works in Canada should work in England should work in Japan.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

So nobody else has any "must-have" resources they want to share?

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Norton's ok, I'm just not a fan of theirs.

I've seen some negative information regarding Spyware Doctor.

Again all of what I said was merely 'preventative' steps to ensure that the problem is not related to malware or virus :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

ComboBox for the win :) Enter a portion of the category name and only those items that match will display in the associated dropdown.

Hope that helps :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Normally I would answer this question with a simple link to a Google search but in this case I'll make an exception and add some more information too :P

Basically there are several methods for tracking web traffic to your website.

Google, for example, offers their "Webmaster Central" and "Google Analytics" to track not just the visitors to your site but various statistics that go along with them.

Most hosting providers also offer you a basic statistics package available at www.yourdomain.com/stats (or something similar)

Alternately, you can write your own tracking software but this is often more work than it's worth with the number of free tracking services already available online.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

As a side note: This would likely have been better placed in ASP.Net, HTML and CSS or Site Layout and Usability.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Not to be too blunt but... the code for the vb version is not that hard to 'translate' to a C# equivalent format...

For instance:

Private Sub IsUserAuthenticated()

Translates to:

private void IsUserAuthenticated()

And...

Response.Redirect("~/Login.aspx")

Is the same in both languages.

And what do you know, a quick google search focused on the msdn.microsoft.com website reveals that you can use the User.Identity.IsAuthenticated method in the following way:

if (User.Identity.IsAuthenticated)
    {
        Page.Title = "Home page for " + User.Identity.Name;
    }
    else
    {
        Page.Title = "Home page for guest user.";
    }

However, now that I've done the work for you I guess there's no need for you to do any research yourself :twisted:

Hope this helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

That is, unless you can come up with something so awe inspiringly diffrent that works.

My point exactly. Which is the part that isn't "easy" :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

One thing I can think of here that might be causing your issue is this...

When you delete a column, all subsequent columns are renumbered to reflect the now missing column no longer being there.

Two possible solutions exist:

  1. Delete from highest column number to lowest column number
  2. Loop your process such that each time a column is deleted the 'empty check' occurs again and gives the new column number for the next empty column.

Otherwise if, for example, you had empty columns # 2, 5, 7 and full columns ranging from 1-15 (excluding those 3)... Deleting column 2 pushes everything down a number making the remaining 'empty' columns 4 and 6 instead. Deleting 4 moves it again making what was originally 7 now 5.

Conversely, if you start from highest to lowest the column renumbering doesn't affect the other 'empty' columns and no loop/recheck is required.

Hope this helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well, the best way for anyone to be able to diagnose an issue with your timer is to see the code behind the timer.

Could you please post your code reference here so we can see it and maybe help you troubleshoot it? :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Not that I ever use built in publish functionality in VS but is there not an option (since you're using the FTP method) to only upload files that are newer than what is on the remote server?

I ask because just about any standard FTP program has this functionality so I would assume that MS would have included it in your publish options as well. Though I learned long ago never to assume any innovation as part of an MS product :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

When a user uses their browser's built in "bookmark page" or "add bookmark" button it is hard coded into the browser that it will default to the URL of the page they are on when they choose this option.

While the user can manually change the URL at this time (or by going into their bookmarks and editing them) I have never come across any in-page functionality that will tell this function to use any URL other than the one the browser is currently visiting.

The only option that I might recommend with regards to keeping your users 'in-the-loop' as it were is to either include them in some form of mailing list so they can be notified when/if the addresses for your site change or... maintain any 'defunct' domains for a set period of time with a redirect page explaining the change in order to catch at least your 'regular visitors'.

If you do have a button that will bookmark a more persistant path for your site then I encourage you to make it as noticeable as possible and explain the reasoning for it to encourage users to utilize it and avoid any issue :)

Hope that helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Welcome to the forums :)

One thing to note: "not too smart" questions > "not thought out" questions > "no detail provided" questions :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Welcome to the forums :) Might run into you in C++ as I endeavor to learn it in the coming months.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Welcome to the forums.

As for not belonging here, no such thing, there's lots of knowledge to be gained from these forums and even 'newbies' can do so.

As for the laptop issue... Periodically the one laptop in my home network (of 2 PC's a Mac and a Dell laptop) has a similar issue where it will inexplicably hibernate or freeze up and a reboot fails to properly start it up again (no screen input, no noticeable interface or reaction to keypress).

However, said laptop also had some rather unpleasant malware issues (courtesy of the fact that it is used regularly by someone who doesn't always follow safe web surfing practices) and since cleaning it up has not had this bootup issue. Part of the problem was that it had the modern day equivalent of a boot sector virus which required some additional steps to get rid of and which was causing issues on reboot of the system.

There are a number of possible causes for boot issues however and if it's a new laptop as you say it is I might recommend a few steps.

  1. Run a reliable remote anti-virus on your system (I use trend micro for this purpose)
  2. Run Windows Update (if it isn't done automatically) as many OEM installations of Windows are pitifully out of date for stability and security updates
  3. Have your dealer that you purchased the laptop from check it for hardware issues

I would …

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Just going to throw this out there but...

IE, any version of IE, doesn't like it when you stack CSS definitions (more than 1 value per definition) as this is a CSS3 ability which is only voluntarily included in most of the 'good' browsers and completely omitted by the rest (particularly MS who seems to be loathe to include anything in their browser architecture until it's a "standard" that must be followed).

My thoughts on this...
Problem 1: "<body class="home page page-id-21 page-template page-template-default">"
Problem 2: "<div class="skip-link screen-reader-text">"
and so on...

That being said, I'm no CSS expert but whenever I get extreme performance variation between IE and FF I look there first and after spending 5 minutes wading through your CSS stylesheet I got lost and decided it was time for a smoke :twisted:

Hope this helps somewhat :) Please remember to mark as solved once the issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Try this resource and see if it helps you.

As for finding a way to use a specific database depending on the user that logs in, simply make your connection string dynamic and populate the DB name at the time of user login. DB name can be stored in the login table along with their username/password/etc and retrieved at the time of login to insert into your dynamic DB connection string for these purposes.

Hope this helps :) Please remember to mark as solved once your issue is resolved. Also, don't be afraid of Google, it doesn't bite :twisted:

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I might recommend that you read this page as it should answer your question on how to prevent editing of your DGV.

As for the second requirement to have a single row editable (ie: the one just entered via ADD) not sure.

I strongly recommend you read through the entire page I linked above, however, as if you don't go beginning to end then some parts may not make sense :twisted: but I don't advise following any of the code examples until you've reached the end of it.

Hope this helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Well, if we assume each character is a byte (generally) then you can use tbText.Text.Length to get the total number of characters (bytes) contained in the text segment you're working with and convert from there.

Hope that helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Interesting... Looks almost exactly like an assignment sheet one might encounter in a programming class.

Data Validation ~ You might want to look into validation methods including but not limited to RegEx (System.Text.RegularExpressions)
Predefined Data ~ You might want to look into dropDownBox or spinBox control population
Preview Form ~ You might want to look into dynamic field population
Date Validation ~ you may want to look into DateTime formatting and use a simple if/else (hint: < DateTime.Now)

Hope that helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

It is much better to hide the parent when you show the child. If you never intend to redisplay the parent then you can create an event handler which will close the parent when the child closes

Oddly enough this is what I was thinking but, having just woken up, my brain wouldn't let me translate it into a proper forum reply :twisted: Good catch though.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Same way you did above works for opening form2 and you use the .Close() operator to close the form you no longer need (after you've opened another form, not before hand).

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

I think I should add code behind the "Done" button on frmLocations that will refresh the combo box on the MainForm.

I think you're on the correct path with this theory :)

Basically, what you need to do is isolate the code that you're using to populate your comboBox in the first place into a code-behind procedure and include a Clear() style statement at the top of the population. Then when you use your "done" button on the other form it needs to call to the population procedure.

Basically by doing this, every time the combo-box is populated it first clears old values and then populates the current values from the table. When called from the "done" button it will do the same, repopulating the box with the updated info.

The Clear() statement should be something like comboBox1.Items.Clear() or similar (I haven't opened my VS C# yet today so can't be 100% sure there).

Hope that helps :) Please remember to mark the thread solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Personally I think you should put the code wherever you like since you didn't bother reading my post :twisted:

As I said above:
In Program.cs (assuming you left everything with default names as it seems you did) you should see: And I wouldn't just go changing the code around without first looking into your application to ensure that changing FORM2 to the primary form won't have additional unpleasant effects on the rest of your code.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

What you're looking for is a Modal form.

This is something that comes up often enough around here so here's a link to a previous thread where a modal dialogue was discussed (please don't post in the old form though, if you have questions about what is discussed there please post them here).

That would suit the needs as you've stated them.

Hope it helps :) Please remember to mark this thread solved once your issue is resolved.

Geekitygeek commented: exactly right :) +1
ddanbe commented: Yes! +7
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Technically you can change the primarily loaded form to your "FORM2" form simply by changing the entry point in your program.

In Program.cs (assuming you left everything with default names as it seems you did) you should see:

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

Really not a huge issue to change that to new Form2() instead. Potential problem is that depending how you've got your forms set up this may cause a bit of an issue with navigation between your code segments as form2 becomes the parent form and form2 then needs to be 'called' into existance later on.

On a side note, particularly for larger programs, always a good idea to name components according to their use with a consistant naming convention throughout your program. Makes it easier to work with code and debug if needed. All references can be obfuscated later but in development it makes things go much smoother overall.

Hope this helps :) Sorry I couldn't get to your 2nd question. Please remember to mark as solved once your issue is resolved.

Edited to make it more colourful and point out things that may have been harder to read in black and white :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

They've got a point AngelicOne and to be honest between nick.crane and Ryshad you've got 2 of the better helpers/posters in this sub-forum helping you which is why I stepped out of this one :twisted: I'd be heedin' their advice if I were you :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

As Rogachev says you are not setting the proper value when passing your date information to the DB.

Your code of:

cmd.Parameters.AddWithValue("dt", textBox11.Text);

is passing a text value as if it were a dateTime value. As long as the textbox is correctly formatted (ie: all the dateTime components in the correct order) you should be able to correct this by changing it to this:

cmd.Parameters.AddWithValue("dt", Convert.ToDateTime(textBox11.Text));

Alternately, you can also follow Rogachev's solution as it only adds 1 line of code to your solution and would be entered as:

cmd.Parameters.Add("@dt", SqlDbType.DateTime);
cmd.Parameters["@dt"].Value = Convert.ToDateTime(textbox11.Text);

Hope that helps :) Please remember to mark as solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

When i run it on another form it work.

The question then is, what is different between the original form you were using and the form that it's working for?

Since I know your original code snippet works as long as textBox10, textBox11 and textBox12 exist in the form and integers are entered into 10 and 11, there must be something inconsistant between your code and your form to be causing an error if you are 100% certain that the numbers you are entering are integers and not in any other format.

I'm almost wondering if in your original form you have the labelling mixed up and either textBox10 or textBox11 is actually some sort of text input in the form instead of one of the 2 numeric inputs.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Hi,

I am entering only integer numbers. But it shows me an error message.

I have a coding on textbox11 that if user enter number on textbox11 then the value stored in textbox10 is muliplyed with textbox11 and answer is shown in the textbox12.

I know what your code is doing... I copied it directly from what you put in your original post into my VS C# and created 3 textboxes to match the names in the associated form.

When I ran it it worked fine, the only time I got the error you were specifying is when I attempted to enter anything OTHER than whole number integer into one of the textboxes.

The error is indicating that the input value in your textbox is not compatible with a conversion to an integer value.

To define, an integer value is a whole number no decimal and as you haven't defined signed or unsigned can be positive or negative ranging between -2,147,483,648 and 2,147,483,647. So... unless your number entered is outside that range, the reason you are getting the error is because you are entering a non-integer (even 1.0 is considered a non-integer as far as conversion goes).

To repeat, your original code works fine, it's the numbers being put into the textboxes that is at issue. (tested repeatedly, not just speculating)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Fairly sure that if any moderators were feeling that friendly they'd approach you and not the other way around :twisted:

Considering how many other things they have to do on an average day (on a volunteer basis I might add) I wouldn't try to rush it :)

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Ok, theory here since I don't know what input you're entering into the text boxes but...

If you're performing a Convert.ToInt32 direct from your textbox input and you're receiving an error such as what you describe I'm going to toss out the assumption that the number you're entering into the textbox is not in "Int32" format (ie: a decimal or double type instead).

Having tested your code myself it works flawlessly as long as the numbers in textBox10 and textBox11 are both integers... the moment I try to add a decimal or double value in textBox11 it gives me the error you specified.

Option 1) change your variables and conversions to double or decimal value instead of int
Option 2) stop entering non-integer values into your textboxes :twisted:

Hope that helps :) Please remember to mark solved once your issue is resolved.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

If pc2 is set up as a SQL server then most likely the sql server component can be accessed directly via the IP of that computer (depending on the network setup and the SQL setup. However, your scenario is very confusing to me.

You indicate your pc1 is your "server" but you indicate that pc2 has your SQL server...

What, exactly, is pc1 serving? And if it requires the SQL server setup on pc2 why not make pc2 your "server" and connect 1 and 3 to it that way?

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

As I said, my method above involves the creation and use of a collection class. Once the collection class is created all the textboxes get added to that collection in order to make them more easily iteratable (not even sure I spelt that right).

There's a lot more to the method than what I provided, I was just giving the direction that would work best based on the scenario you proposed at the top. However, I agree with GDICommander that breaking the page into more manageable bits might make more sense depending how you do it.

Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

Wow... seriously? My Blackberry couldn't even handle posting a reply to this while I was out today?

Ok, I'll type it again :P essentially when you use .\\SQLEXPRESS it assumes the default install location for SQLEXPRESS on whatever machine it's being run on.