Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Gary Stafford

@Gary Stafford
About
Posts
25
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • show Progress for Long Running Query
    G Gary Stafford

    I've used images form these sites: http://www.ajaxload.info/[^] http://www.preloaders.net/[^]

    Regards, Gary

    ASP.NET database question csharp javascript asp-net

  • show Progress for Long Running Query
    G Gary Stafford

    The challenge of a progress bar as you noted, server-or client-side, is difficulty of what to base the increment on during the query. Building on the suggestion of the first reply, how an animated gif image that symbolizes the query is running, combined with a counter that increments in seconds as the process running. Also, a message that warns searches could take from X - Y seconds, just so they don't think it's locked up. Those three elements might make the wait more bearable for the user.

    Regards, Gary

    ASP.NET database question csharp javascript asp-net

  • Distorting Text
    G Gary Stafford

    I have not used that specific captcha technique I mentioned, but I do use ImageMagick (IM) with ASP.NET. I have a pretty basic article on COde Project about generating previews from uploaded images with IM, Using ImageMagick to Create Previews and Thumbnails from Uploaded Images[^]. This is similar to what you are trying to do by creating a dynamic image and return it to the browser. The key method is CallImageMagick(string fileArgs). You pass your argument, such as the captcha command, which defines the distortions and the output path of the file. The random string used to create the captcha using IM would be stored and used to verify the user response to the captcha challenge. IM is easy to download and install. The latest update which I just installed on our server was "ImageMagick-6.6.0-7-Q16-windows-dll.exe". Make sure to check the last install option - "Install ImageMagickObject OLE Control...", so that MagickCMD.exe will be installed. You will need to provide the path to this file in your code; see my article. There are several other good articles on CodeProject about using IM with ASP.NET. That is where I learned about it.

    Regards, Gary

    ASP.NET graphics question

  • how to calculate total in the gridview
    G Gary Stafford

    You could do it on the client-side with jQuery and save a lot of server-side processing and roundtrips. It would be easy to attach an event listener to the checkbox and total all the item's subtotals, etc. Here is a link to an example that updates the total the items in the order table as you add and remove items. It doesn't use Web Forms, but just as easily could: Interactive Form Functionality on the Client-Side Using jQuery[^]. There is a working example at http://altweb.lazerinc.com/jquery/order_dev.htm[^].

    Regards, Gary

    modified on Monday, April 5, 2010 9:09 AM

    ASP.NET csharp tutorial asp-net

  • Distorting Text
    G Gary Stafford

    Have you considered using ImageMagick? We use it for a number of similar processes. Fred's ImageMagick Scripts contains a captcha sample script: http://www.fmwconcepts.com/imagemagick/captcha/index.php[^]

    Regards, Gary

    ASP.NET graphics question

  • Printable DataGrid
    G Gary Stafford

    We have a sales program that allows the user to view the sales report on screen, contained in a paged GridView. The user has the option to print the report. When they select 'Print', the code: 1. Modifies the GridView to display all rows (vs. paging) by changing the PageSize property. 2. Hides all extraneous page elements by modifying their Visible properties. 3. Changes the page's Theme from a screen oriented theme to a theme optimized for printing by modifying (Page.Theme and Page.StylesheetTheme) properties. 4. Calls the browser's print command via JavaScript. Hopes this helps answer your question.

    Regards, Gary

    C# csharp css question

  • Sending mail....problem
    G Gary Stafford

    I agree with the previous comment, it seems like your SMTP mail server must be configured incorrectly in your web.config file. I tested your code (slightly modified), using localhost as the mail server; it worked just fine.

    //Test Strings
    string TxtEmail = "Sue.Smith@123.com";
    string TxtName = "Sue Smith";
    string TxtMessage = "This is a test email message.";

    using(MailMessage message = new MailMessage())
    {
    message.From = new MailAddress(TxtEmail, TxtName);
    message.To.Add(new MailAddress("rohanrajpoot@in.com"));
    message.Subject = "This person has contacted us!";
    message.IsBodyHtml = false;
    message.Body = TxtMessage;
    SmtpClient smtpClient = new SmtpClient { Host = "localhost" };
    smtpClient.Send(message);
    }

    Regards, Gary

    ASP.NET help csharp asp-net dotnet com

  • How to fix a broken scrollbar in datagrid
    G Gary Stafford

    I tested your div tag, shortened to 100 px to force a vertical scroll bar, with a DataGrid loaded with data in VS2008. It worked just fine in IE8 and Mozilla 5. There has to be more to the story (code), to 'break' it, as the earlier commenter said.

    <div style="height: 100px; overflow: auto;">
    <asp:DataGrid runat="server" DataSourceID="LinqDataSource1"></asp:DataGrid>
    </div>

    Regards, Gary

    modified on Monday, July 13, 2009 9:31 PM

    ASP.NET help tutorial question

  • Taking variables from other classes.
    G Gary Stafford

    If I understand your question, Leveling should inherit CharClasses and use the base constructor characterClass, as follows: Leveling lvl = new Leveling("Warrior");

    public class CharClasses
    {
    public int healthPoints = 0;
    public int manaPoints = 0;
    public int strength = 0;
    public int dexterity = 0;
    public int speed = 0;
    public int intelligence = 0;

    public CharClasses(string characterClass)
    {
        if(characterClass == "Warrior")
        {
            healthPoints = 100;
            manaPoints = 10;
            strength = 10;
            dexterity = 5;
            speed = 3;
            intelligence = 0;
        }
    
        if(characterClass == "Archer")
        {
            healthPoints = 75;
            manaPoints = 10;
            strength = 3;
            dexterity = 10;
            speed = 5;
            intelligence = 0;
        }
    
        if(characterClass == "Assassin")
        {
            healthPoints = 75;
            manaPoints = 10;
            strength = 5;
            dexterity = 3;
            speed = 10;
            intelligence = 0;
        }
    
        if(characterClass == "Mage")
        {
            healthPoints = 50;
            manaPoints = 50;
            strength = 0;
            dexterity = 5;
            speed = 3;
            intelligence = 10;
        }
    }
    

    }

    public class Leveling : CharClasses
    {
    public int level = 1;
    public int experience = 0;

    public Leveling(string characterClass)
        : base(characterClass)
    {
        if(experience == ((experience + 100) \* 1.5))
        {
            level++;
        }
    }
    

    }

    If you use inheritance, and don't need to instantiate CharClasses directly, you may want to change you your access modifiers from all public to protected, etc.

    Regards, Gary

    C# help question

  • Link protection
    G Gary Stafford

    I dug up an old (2002 old) classic ASP/VB site I created that required the user to enter a username and password, which is checked against the database. If they are successful, a session variable in the global.asa file is set to true. Each page checks the variable first and bounces the user if the variable returns false. Top of each page:

    'Check if user is logged in
    Dim LoggedIn
    LoggedIn = Session("LoggedIn")
    If LoggedIn <> "True" Then
    Response.Redirect("login.asp")
    End If

    global.asa

    Sub Session_OnStart
    'Create a Session variable to track if the user has logged in
    Session("LoggedIn") = "False"
    ...
    End Sub

    Hope this helps.

    Regards, Gary

    ASP.NET com tutorial question

  • can't get multiple files when attachment through stream class.
    G Gary Stafford

    I realize this doesn't answer your code-specific question, but is zipping the files an option? It will provide better speed and reliably, and limit your attachments to a single file. You can use the System.IO.Compression class to compress the stream of files. Advantages of zipping files for email: Zip or unzip a file[^]

    Regards, Gary

    ASP.NET help question

  • Hiding value into grid view
    G Gary Stafford

    If I understand your question correctly, wouldn't setting the columns Visible property to false provide you with the solution you seek (Visible="false"). This is a very common technique.

    Regards, Gary

    ASP.NET css tutorial

  • Send Email in Arabic
    G Gary Stafford

    I've used theMessage.BodyEncoding = Encoding.UTF8; Is using Encoding.Unicode better for Arabic than Encoding.UTF8?

    Regards, Gary

    C# csharp html com question

  • c# windows application......
    G Gary Stafford

    I would use Application.Exit(); after completing the work, to exit the Form and the application. MSDN: http://msdn.microsoft.com/en-us/library/ms157894.aspx[^]

    Regards, Gary

    C# csharp

  • How I can Convert one Color to Another Color
    G Gary Stafford

    If I understood your question, you have a background you wish to transition (blend) from one color to another, but want the blend to dynamically scale to the height of the menu. I believe this article will solve your problem, using JavaScript: http://www.elctech.com/snippets/javascript-color-fade-function-find-the-hex-value-between-two-hex-values[^]

    Regards, Gary

    Web Development csharp java asp-net tools tutorial

  • Implementing Timer Functionality in Online Test Application
    G Gary Stafford

    If I understood your question correctly, you do not want to penalize the user for the time it takes the Page to PostBack. Why don't you add an OnClick() event to the Next button to capture the time remaining and send it to a Session variable, first, before calling the next question, etc. Then once the page has posted back you can retrieve the time remaining from the Session variable?

    Regards, Gary

    C# csharp asp-net database sysadmin help

  • moving in windows form by keyboard ENTER key
    G Gary Stafford

    I agree with first two answers. Does it have to be the Enter key? Using the Tab key with TabIndex to indicate a specific indexing of controls is easier and more standard. Enter will cause a Submit on the form?

    Regards, Gary

    modified on Tuesday, June 23, 2009 9:21 PM

    C# help tutorial question

  • Writing error to a browser
    G Gary Stafford

    Yes, the first answer (Computafreak's) is correct, Response.Write(ex.Message); if your writing an ASP.NET Web Application. But, looking at your code, I suspect you are writing a Windows Application due to your reference to Console.WriteLine(). This is a stretch, you want to send a Windows Application generated error message to a web browser window? Who's browser - yours, or a user of the application? At what URL? I think you may want to CLARIFY your question with some more details on the type of application you are writing.

    Regards, Gary

    C# database help question

  • Http post [modified]
    G Gary Stafford

    Hidden field, use Request.Form instead:

    string fname = "";
    if (Request.Form["customer_fname"] != null)
    { fname = Request.Form["customer_fname"]; }
    Response.Write("fname value: " + fname);

    Regards, Gary

    C# csharp html asp-net sales question

  • Sending Emails
    G Gary Stafford

    You point your message to your email server. For example:

    using System.Net.Mail;

    class Emailer
    {
    private void SendEmail()
    {
    MailMessage theMessage = new MailMessage();
    MailAddress whoTo = new MailAddress("John.Doe@abc.com", "John Doe");
    MailAddress whoFrom = new MailAddress("Sue.Smith@123.com", "Sue Smith");
    theMessage.To.Add(whoTo);
    theMessage.From = whoFrom;
    theMessage.Subject = "Real Important Message";
    theMessage.Priority = MailPriority.Normal;
    theMessage.Body = "This is a real important email message.";
    theMessage.IsBodyHtml = true;

        SmtpClient client = new SmtpClient();
        client.Host = "mail.123.com"; // <- Your email server goes here
        client.Send(theMessage);
    
    }
    

    }

    Regards, Gary

    Web Development csharp sysadmin question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups