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

g00fyman

@g00fyman
About
Posts
266
Topics
79
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • S/MIME Emails
    G g00fyman

    Hi all, Does anyone know of how to (or point me to some information on how to) send and email using X.509 PKI with attachments. There are a lot of posts around the Internet on using X.509 without attachments but it fails for emails with attachments. I would like to do this myself with native C# code and not use a third party product if possible. Thanks, Maurice

    ASP.NET csharp c++ tutorial

  • dynamically adding buttonfields to gridview
    G g00fyman

    ok, I have tried everything I can think of and cannot do it server side. I have tried ButtonFields, TemplateFields, CommandFields and all offer different access to the button but it still renders it's own javascript that I cannot change. So ... I have resolved it with client side code let the gridview to render it out. If anyone requires the code, see below. If anyone has a server side solution please let me know. Thanks, Maurice Client Code:

    /* function to handle delete confirmation placement on gridview delete buttons */
    function setupDeleteConfirmation() {
    var imgs = document.getElementsByTagName('input');
    for (var i in imgs) {
    if (imgs[i].title == 'Delete' && imgs[i].className == 'delete-button') {
    imgs[i].oldClick = imgs[i].onclick;
    imgs[i].onclick = function() {
    var answer = confirm('Are you sure you want to delete this item?\n\nClick OK to delete this item or Cancel to keep it.');
    if (answer == true) { this.oldClick; }
    return answer;
    };
    }
    }
    }

    Server Code:

    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);

      if (DesignMode == false)
      {
        if (Page.ClientScript.IsClientScriptIncludeRegistered("\_GridViewClicks") == false)
        {
          Page.ClientScript.RegisterClientScriptInclude("\_GridViewClicks", Page.ClientScript.GetWebResourceUrl(GetType(), GRID\_JS));
        }
      }
      
      // other stuff here
    }
    

    protected override void Render(HtmlTextWriter writer)
    {
    base.Render(writer);

      writer.WriteLine(" // <!\[CDATA\[");
      writer.WriteLine("  setupDeleteConfirmation(); // \]\]>");
      writer.WriteLine("");
    }
    
    ASP.NET css help question

  • dynamically adding buttonfields to gridview
    G g00fyman

    OK, I have worked out why, should have found it earlier. The OnClientClick is being output like this when I add my own client click code:

    onclick="return confirm('Are you sure you want to delete this item?\n\nClick OK to delete this item or Cancel to keep it.');javascript:__doPostBack('OrganicGridView1','Delete$0')"

    So my new question is, what event do I need to hook to so I can output something like this. I could do it client side but I would rather not.

    onclick="if(confirm('Are you sure you want to delete this item?\n\nClick OK to delete this item or Cancel to keep it.')) { javascript:__doPostBack('OrganicGridView1','Delete$0') }"

    Thanks Maurice

    ASP.NET css help question

  • dynamically adding buttonfields to gridview
    G g00fyman

    Hi all, Happy New Year :) Can someone please help me with the following scenario. I do not like how the default setting is to have the select and delete button together in a grid view row so I am extending gridview (for other reasons) and am dynamically adding my own fields, select at 0, delete at columns.count - 1. Whenever I add OnClientClick code to the delete button the button is just posting back and not firing a delete command.

    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);

      ButtonField select = new ButtonField();
      select.CommandName = "Select";
      select.ButtonType = ButtonType.Image;
      select.ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(), EDIT\_ICON);
      Columns.Insert(0, select);
    
      ButtonField delete = new ButtonField();
      delete.CommandName = "Delete";
      delete.ButtonType = ButtonType.Image;
      delete.ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(), DELETE\_ICON);
      Columns.Add(delete);
    }
    
    protected override void OnPreRender(EventArgs e)
    {
      base.OnPreRender(e);
      
      if (Page.IsPostBack == false)
      {
        foreach (GridViewRow row in Rows)
        {
          if (row.RowType == DataControlRowType.DataRow)
          {
            ImageButton select = row.Cells\[0\].Controls\[0\] as ImageButton;
            select.ToolTip = "Modify";
            select.AlternateText = "Modify";
            select.CssClass = "select-button";
    
            ImageButton delete = row.Cells\[row.Cells.Count - 1\].Controls\[0\] as ImageButton;
            // the following line causes button to not fire a delete command
            //delete.OnClientClick = "return confirm('Are you sure you want to delete this item?\\\\n\\\\nClick OK to delete this item or Cancel to keep it.');";
            delete.ToolTip = "Delete";
            delete.AlternateText = "Delete";
            delete.CssClass = "delete-button";
          }
        }
      }
    }
    

    Thanks, Maurice

    ASP.NET css help question

  • detect window drag
    G g00fyman

    Thanks for the reply, I need to determine out of process windows being dragged and I need to know which window it is. i.e., get a handle to it. Thanks, Maurice

    C# question csharp

  • detect window drag
    G g00fyman

    hi all, how can i detect if a (any) window is being dragged? Obviously with PInvoke, but I cannot find any C# examples. If anyone has any or could explain, could you please do so? Thanks, Maurice

    C# question csharp

  • url encode with '+'
    G g00fyman

    thank you i have resolved the issue. if i urldecode the query in the handler it doesnt work, but if i urlencode the url in the page then just process it in the handler without urldecode'ing it, then it works fine. regards, maurice.

    ASP.NET database sysadmin tutorial question announcement

  • url encode with '+'
    G g00fyman

    hello, thanks for the reply. that page encodes news+events as news%2Bevents which is what i get as input to the handler in the raw url (Request.QueryString) but when i do Request.QueryString["qText"]; it return "news events", replacing the %2B with a space. thanks, Maurice

    ASP.NET database sysadmin tutorial question announcement

  • url encode with '+'
    G g00fyman

    hi all, i have a httphandler that returns an image when i send it text (and other parameters). The trouble is i have a need to send the string 'news + events', but the '+' is not being output at all. code in page _HeadingTextImage.ImageUrl = "textimage.ashx?text=" + Server.UrlEncode("news+events"); code in httphandler string qText = (query["text"] == null) ? UsageText : context.Server.UrlDecode(query["text"]); qText always = "news events" when i step into it. can anyone tell me how to do this please? thanks, Maurice

    ASP.NET database sysadmin tutorial question announcement

  • CSS element parser
    G g00fyman

    Hi, The conversion was done using the JLCA (Java Language Conversion Assistant) that comes with VS .NET 2005. My task was only to convert the source to a usable format for other team members. From memory though (and it was a while ago) they were attempting to achieve what you are trying to achieve, so I assume the CSSParser application contains all that is required. Sorry for my vagueness but I was not directly involved in the latter stages of development, I was only called on because I knew both languages (JAVA & .NET). Regards, g00fy

    ASP.NET css xml json question

  • CSS element parser
    G g00fyman

    try this[^] its written in java, but if i remember corerctly i used it a while ago and converted it to c# without too much problem, i would give you the c# source only my old boss has it :( regards, g00fy

    ASP.NET css xml json question

  • Back Button Problem
    G g00fyman

    It pops up again because it is displaying the cached page that is in your history. I imagine the back button is similar to javascript:history.go(-1); I don't know if restricting the caching of the page will work or not, but i have a domain hosting control panel that always (seems to) re-request a page when i click the back button on the browser. This would be the result you are aiming for, then you can check server side if you want the message box code to be written into the page. g00fy

    Web Development help question java sysadmin tools

  • ASP.NET GetWebResourceUrl()
    G g00fyman

    Hi all, just wondering if there is any way to embed an ASP.NET page into the assembly resources and have it served to the client. The standard GetWebResourceUrl() with type "text/html" simply returns the 'raw' code in the file and is not passed through the .NET web server, is there a way to acheive this? I am developing a custom server control and would like to embed this page within an iframe in the control. regards, g00fy

    Web Development csharp html asp-net sysadmin question

  • replace a div with another div
    G g00fyman

    thanks guffa, i knew that but forgot it, just needed a kick in the head to remind me. g00fy :D

    Web Development csharp javascript asp-net database sysadmin

  • replace a div with another div
    G g00fyman

    hi all, i am writing a custom server control for asp.net and i need to implement some javascript to replace a hidden div with a div that is already visible then set the replaced div to visible. at the moment it is working but when i simply toggle visibiity the div is not displayed at the same position within its parent div this is my javascript include.

    function ShowPanel(panel)
    {
    for(var i = 0; i < resources.length; i++)
    {
    var res = resources[i];
    var obj = document.getElementById(res);
    if(obj)
    {
    obj.style.visibility = 'hidden';
    }
    }
    panel = document.getElementById(panel);
    if(panel) { panel.style.visibility = "visible"; }
    }

    and this is my output for the javascripts vars

    <script type="text/javascript">
    <!--
    var resources = new Array('ToolbarStart', 'ToolbarBackground', 'ToolbarEnd', 'ToolbarSeperator', 'ToolbarHome', 'ToolbarCopy', 'ToolbarDelete', 'ToolbarFolderUp', 'ToolbarMove', 'ToolbarNewFile', 'ToolbarNewFolder', 'ToolbarRename', 'ToolbarUpload', 'ToolbarDownload', 'ToolbarZip', 'ToolbarAbout', 'ToolbarSettings', 'ToolbarSaveAsXml', 'ToolbarPrintStructure', 'ToolbarFileSystem');
    var useTransitions = true;// --></script>

    and this is the divs i want to replace with each other

    <div id="ActionsPanel">
    <div>
    <div id="ToolbarUpload" style="visibility:hidden;top:5px;left:5px;z-index:3;">
    blah blah blah
    </div><div id="ToolbarDownload" style="visibility:hidden;top:5px;left:5px;z-index:4;">

    					blah blah blah
    				</div><div id="ToolbarRename" style="visibility:hidden;top:5px;left:5px;z-index:5;">
    					blah blah blah
    				</div>
    			</div>
    		</div>
    

    any help please? regards, g00fy

    Web Development csharp javascript asp-net database sysadmin

  • Disable save as and print button of ie
    G g00fyman

    here here it is almost as annoying as all that popup crap getting around. g00fy

    Web Development

  • Change the Cursor
    G g00fyman

    you need to use javascript *something* like this

    function LongTask(obj)
    {
    obj.style.cursor = "HourGlass";

    /* logic in here */

    obj.style.cursor = "Default";
    }

    g00fy

    Web Development csharp asp-net help

  • Best practice? (SQLCommand and Web Services)
    G g00fyman

    Why not use business objects at the webservices like DeKlarit (although you need to buy it), but some sort of ORM at the webservice, this will de-couple the database from the webservices to start with, then transfer datasets to and from the webservice. when you want something from the server call a function on the dataadapter interface (interfaces only required on client) let the web service fill the dataset then bind it at the client. viola g00fy

    Web Development database help question wcf business

  • objec.style.value setting
    G g00fyman

    is this a typo?

    tibiz wrote:

    echo ""; and call this in PHP: echo "";

    should it be

    value=\"$strFormText[0]\" name=\"$strFormText[0]\">";

    and call this in PHP:
    echo "";

    note the variable call in the name and removed attribute code. also its been a while since i coded any php but i don't think '$strFormText[0]' will echo the var i think you need '"+$strFormText[0]+"' regs, g00fy

    Web Development php tools

  • How to create a shortcut for my application
    G g00fyman

    you need to use system wide hook so that the os can intercept any key strokes and determine if it matches the ones you want then you process them and fire the application. then you need a shortcut editor to change the shortcut by listening to the keys the user enters and rather than opening the program, assign it as the hotkey. below is a class i found and adapted to suit my needs ( the class didn't have any copyright info in it and i can't remember where i found it, so i apologize if anyone is offended, although i did modify and improve it extensively ) DO NOT USE THIS CODE FOR MALICIOUS ACTIVITY, ELSE I WILL BE *VERY* DISSAPOINTED, AND YOU MAY GO TO HELL FOR IT!

    using System;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    namespace GlobalKeyHook
    {
    /// /// KeyboardHook, as the name implies, hooks into the windows messaging system to
    /// catch global keystrokes.
    ///
    /// /// /// The hook is automatically released when the class is disposed.
    /// You can force the release by calling
    /// The class exposes a KeyDown and KeyUp event, which can be used as any
    /// other keydown/up event in the .net framework. The sender object will always be
    /// this class, but all global keystrokes are processed.
    /// As in other keydown/up events, setting handled of the keyeventargs object to true
    /// e.Handled=true; will prevent other hooks from executing. For system keys
    /// as the Windows key, this means that the key gets 'blocked'
    ///
    public class KeyboardHook : IDisposable
    {
    #region Hook-dlls

    \[DllImport("user32", EntryPoint = "SetWindowsHookExA")\]
    private static extern int SetWindowsHookEx(int idHook, KeyBoardCatcherDelegate lpfn, int hmod, int dwThreadId);
    
    \[DllImport("user32.dll", CharSet = CharSet.Auto,
     ExactSpelling = true, CallingConvention = CallingConvention.Winapi)\]
    private static extern short GetKeyState(int keyCode);
    
    \[DllImport("user32", EntryPoint = "MapVirtualKey")\]
    private static extern int MapVirtualKey(int wCode, int wMapType);
    
    \[DllImport("user32", EntryPoint = "CallNextHookEx")\]
    private static extern int CallNextHook(int hHook, int ncode, int wParam, KeybHookStruct lParam);
    
    private const int
      WH\_KEYBOARD = 2,
      WH\_KEYBOARD\_LL = 13; //Global keyboard hook. 
    
    \[DllImport("user32", EntryPoint = "UnhookWindowsHookEx")\]
    private static exte
    
    C# csharp help tutorial
  • Login

  • Don't have an account? Register

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