Grid Kontrolu Acil Yardim

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    kanvegul
    kanvegul's avatar
    Kayıt Tarihi: 02/Haziran/2002
    Erkek

    Merhaba arkadaslar

     

    asp.net 2.0 bir grid islemi yapiyorum . webgrid controlunu kullaniyorum fakat grid uzerinde sag tiklayinca menu geliyor onu engellemek istiyorum veya menuden bazi linkleri silmek istiyorum fakat olmuyor reflectorle dll actim fakat isin icinden cikamadim menu kontrolunun reflectorle acilmis kodu asagida jQuery yazilmis bir kontrol. kirmizi ile isaret ettigim yeri iptal emek istiyorum mesela ama olmuyor veya menuyu iptal etmek istiyorum oda olmuyor

    Grid1.Scripts.DisableContextMenu = false gibi kodu var kod yaziliminda sorun yok ama calistirinca projeyi hata veriyor.jQuery ile mudale edersek nasil ederiz. ve asp.net nasil ekleyebilirim

    yardimci olursaniz sevinirim

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 44:     Grid1.DataBind();
    Line 45:
    Line 46: Grid1.Scripts.DisableContextMenu = false;
    Line 47: //WebGrid.ScriptSettings.DisableThickBox
    Line 48: //Grid1.ContextMenu.Visible = false;

    Source File: e:\Documents and Settings\TLT\Belgelerim\Visual Studio 2008\WebSites\WebSite1\Default.aspx.cs    Line: 46

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
    _Default.Page_Load(Object sender, EventArgs e) in e:\Documents and Settings\TLT\Belgelerim\Visual Studio 2008\WebSites\WebSite1\Default.aspx.cs:46
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +47
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



    menu%20sorunu


    if(jQuery)( function() {
        $.extend($.fn, {
           
            contextMenu: function(o, callback) {
                // Defaults
                if( o.menu == undefined ) return false;
                if( o.inSpeed == undefined ) o.inSpeed = 150;
                if( o.outSpeed == undefined ) o.outSpeed = 75;
                // 0 needs to be -1 for expected results (no fade)
                if( o.inSpeed == 0 ) o.inSpeed = -1;
                if( o.outSpeed == 0 ) o.outSpeed = -1;
                // Loop each context menu
                $(this).each( function() {
                    var el = $(this);
                    var offset = $(el).offset();
                    // Add contextMenu class
                    $('#' + o.menu).addClass('contextMenu');
                    // Simulate a true right click
                    $(this).mousedown( function(e) {
                        var evt = e;
                        $(this).mouseup( function(e) {
                            var srcElement = $(this);
                            $(this).unbind('mouseup');
                            if( evt.button == 2 ) {
                                // Hide context menus that may be showing
                                $(".contextMenu").hide();
                                // Get this context menu
                                var menu = $('#' + o.menu);
                               
                                if( $(el).hasClass('disabled') ) return false;
                               
                                // Detect mouse position
                                var d = {}, x, y;
                                if( self.innerHeight ) {
                                    d.pageYOffset = self.pageYOffset;
                                    d.pageXOffset = self.pageXOffset;
                                    d.innerHeight = self.innerHeight;
                                    d.innerWidth = self.innerWidth;
                                } else if( document.documentElement &&
                                    document.documentElement.clientHeight ) {
                                    d.pageYOffset = document.documentElement.scrollTop;
                                    d.pageXOffset = document.documentElement.scrollLeft;
                                    d.innerHeight = document.documentElement.clientHeight;
                                    d.innerWidth = document.documentElement.clientWidth;
                                } else if( document.body ) {
                                    d.pageYOffset = document.body.scrollTop;
                                    d.pageXOffset = document.body.scrollLeft;
                                    d.innerHeight = document.body.clientHeight;
                                    d.innerWidth = document.body.clientWidth;
                                }
                                (e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
                                (e.pageY) ? y = e.pageY : x = e.clientY + d.scrollTop;
                               
                                // Show the menu
                                $(document).unbind('click');
                                $(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
                                // Hover events
                                $(menu).find('A').mouseover( function() {
                                    $(menu).find('LI.hover').removeClass('hover');
                                    $(this).parent().addClass('hover');
                                }).mouseout( function() {
                                    $(menu).find('LI.hover').removeClass('hover');
                                });
                               
                                // Keyboard
                                $(document).keypress( function(e) {
                                    switch( e.keyCode ) {
                                        case 38: // up
                                            if( $(menu).find('LI.hover').size() == 0 ) {
                                                $(menu).find('LI:last').addClass('hover');
                                            } else {
                                                $(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
                                                if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
                                            }
                                        break;
                                        case 40: // down
                                            if( $(menu).find('LI.hover').size() == 0 ) {
                                                $(menu).find('LI:first').addClass('hover');
                                            } else {
                                                $(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
                                                if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
                                            }
                                        break;
                                        case 13: // enter
                                            $(menu).find('LI.hover A').trigger('click');
                                        break;
                                        case 27: // esc
                                            $(document).trigger('click');
                                        break
                                    }
                                });
                               
                                // When items are selected
                                $('#' + o.menu).find('A').unbind('click');
                                $('#' + o.menu).find('LI:not(.disabled) A').click( function() {
                                    $(document).unbind('click').unbind('keypress');
                                    $(".contextMenu").hide();
                                    // Callback
                                    if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
                                    return false;
                                });
                               
                                // Hide bindings
                                setTimeout( function() { // Delay for Mozilla
                                    $(document).click( function() {
                                        $(document).unbind('click').unbind('keypress');
                                        $(menu).fadeOut(o.outSpeed);
                                        return false;
                                    });
                                }, 0);
                            }
                        });
                    });
                   
                    // Disable text selection
                    if( $.browser.mozilla ) {
                        $('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
                    } else if( $.browser.msie ) {
                        $('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
                    } else {
                        $('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
                    }
                    // Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
                    $(el).add('UL.contextMenu').bind('contextmenu', function() { return false; });
                   
                });
                return $(this);
            },
           
            // Disable context menu items on the fly
            disableContextMenuItems: function(o) {
                if( o == undefined ) {
                    // Disable all
                    $(this).find('LI').addClass('disabled');
                    return( $(this) );
                }
                $(this).each( function() {
                    if( o != undefined ) {
                        var d = o.split(',');
                        for( var i = 0; i < d.length; i++ ) {
                            $(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
                           
                        }
                    }
                });
                return( $(this) );
            },
           
            // Enable context menu items on the fly
            enableContextMenuItems: function(o) {
                if( o == undefined ) {
                    // Enable all
                    $(this).find('LI.disabled').removeClass('disabled');
                    return( $(this) );
                }
                $(this).each( function() {
                    if( o != undefined ) {
                        var d = o.split(',');
                        for( var i = 0; i < d.length; i++ ) {
                            $(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
                           
                        }
                    }
                });
                return( $(this) );
            },
           
            // Disable context menu(s)
            disableContextMenu: function() {
                $(this).each( function() {
                    $(this).addClass('disabled');
                });
                return( $(this) );
            },
           
            // Enable context menu(s)
            enableContextMenu: function() {
                $(this).each( function() {
                    $(this).removeClass('disabled');
                });
                return( $(this) );
            },
           
            // Destroy context menu(s)
            destroyContextMenu: function() {
                // Destroy specified context menus
                $(this).each( function() {
                    // Disable action
                    $(this).unbind('mousedown').unbind('mouseup');
                });
                return( $(this) );
            }
           
        });
    })(jQuery);

  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    kanvegul
    kanvegul's avatar
    Kayıt Tarihi: 02/Haziran/2002
    Erkek

    up

  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    crafty
    crafty's avatar
    Kayıt Tarihi: 19/Eylül/2006
    Erkek

    hacı jscript ile sağ tıklamayı engelleyebilirsin nasıl kullanacağın vs. zaten kodları veren sitelerde yazıyor... anladığım kadarıya veritabanından veri çekip onları gridde listeliyorsun da bunun için gridview i neden kullanmıyorsun webgrid in özelliği nedir?


    Kasnak yuvarlandı elek oldu, eski orospular melek oldu...
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    kanvegul
    kanvegul's avatar
    Kayıt Tarihi: 02/Haziran/2002
    Erkek

    crafty bunu yazdı:
    -----------------------------

    hacı jscript ile sağ tıklamayı engelleyebilirsin nasıl kullanacağın vs. zaten kodları veren sitelerde yazıyor... anladığım kadarıya veritabanından veri çekip onları gridde listeliyorsun da bunun için gridview i neden kullanmıyorsun webgrid in özelliği nedir?


    -----------------------------

    hocam webgrid hazir kontrol 10 gundur bu kontrolle ugrasiyorum ajax bir kontrol ama sadece about kismini kaldiramadim onuda halledersem her yerde kullanilabirli bir kontrol olacak

  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    kanvegul
    kanvegul's avatar
    Kayıt Tarihi: 02/Haziran/2002
    Erkek

    tamam buldum tesekkurler

     

  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    crafty
    crafty's avatar
    Kayıt Tarihi: 19/Eylül/2006
    Erkek

    hacı nasıl bulduğunu da yazda buraya hiç olmassa yarın birgün aynı dertten muzdarip kişiler formda arama yaptığı zaman nasıl yapıldığını bulabilsin...


    Kasnak yuvarlandı elek oldu, eski orospular melek oldu...
  7. KısayolKısayol reportŞikayet pmÖzel Mesaj
    kanvegul
    kanvegul's avatar
    Kayıt Tarihi: 02/Haziran/2002
    Erkek

      <ContextMenu  >
                   <WG:SystemMenuItem id="about" MenuType="About" Visible="false"/>
                     <WG:SystemMenuItem id="help" MenuType="Help" Visible="false"/>
                         <WG:SystemMenuItem id="CollapsedGrid" MenuType="CollapsedGrid" Visible="false"/>
                          <WG:SystemMenuItem id="Export" MenuType="Export" Text="Excel Aktar" CssClass="wgcontextmenuexport separator"/>
                           <WG:SystemMenuItem id="Print" MenuType="Print" Text="Yazdır" CssClass="wgcontextmenuprint"/>
                            <WG:SystemMenuItem id="Refresh" MenuType="Refresh" Text="Yenile" CssClass="wgcontextmenurefresh"/>
                  
                   </ContextMenu>

     

    ile gridin icine yazarak cozuluyor hocam

Toplam Hit: 1697 Toplam Mesaj: 7