views:

170

answers:

2

Hi Everybody,

I've posted a breakpoint in web user control. But Control is not going on breakpoint. Why is this happening. I have done inline code.

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="IBlog.Web.HandleUserControl" %>

<script language="C#" runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Pagemenu.pageload();
    }
    public string Geturl(string url)
    {
        return Pagemenu.Geturl(url);
    }
    protected void menu1_MenuItemClick(object sender, MenuEventArgs e)
    {
        Pagemenu.menu1_MenuItemClick(sender, e);
    }

    //protected void Page_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    Pagemenu.Page_SelectedIndexChanged(sender, e);

    //}

    //protected void MoreClick(object sender, EventArgs e)
    //{
    //    DataList2.Visible = true;

    //}

    protected void lbmore_Click(object sender, EventArgs e)  //this is the code i want to debug
    {

    }
</script>

 <script type="text/javascript">
    function mover()
    {
    var elem = document.getElementById("<%= DataList2.ClientID %>");
    elem.style.display="block"

    }
    function mout()
    {
    var elem = document.getElementById("<%= DataList2.ClientID %>");
    elem.style.display="none" 
    }

</script>

<div class="navi">
    <div class="pages">
        <ul>
            <asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">
                <ItemTemplate>
                    <li><a href='<%#Geturl((string)DataBinder.Eval(Container.DataItem, "URL"))%>'>
                        <%# DataBinder.Eval(Container.DataItem, "Title") %>
                    </a></li>
                </ItemTemplate>
            </asp:DataList>
        </ul>
    </div>
     <asp:LinkButton ID="lbmore" runat="server" Text="More" OnClick="lbmore_Click"></asp:LinkButton>
    <div class="pages2" id="more" runat="server">

        <%--<a href="" onmouseover="mover()" onmouseout="mout()">More</a>--%>
        <ul style="background-color: #626669; padding: 0 6px 0 6px; margin: 28px 0 0 0px">
            <asp:DataList ID="DataList2" runat="server" Visible="false">
                <ItemTemplate>
                    <li style="float: left;"><a href='<%#Geturl((string)DataBinder.Eval(Container.DataItem, "URL"))%>'>
                        <%# DataBinder.Eval(Container.DataItem, "Title") %>
                    </a></li>
                </ItemTemplate>
                <ItemStyle Wrap="True" />
            </asp:DataList>
        </ul>

    </div>
</div>
+1  A: 

You've got an empty method - the framework won't allow you to attach a debugger in there, as there's nothing to do - the compiler will have optimised that code base out, as there's no code in the method.

Have you tried adding some simple code in the method to force it to do something (declare, set and view a variable for example)?

Edit to respond to comments

You have specified debug="true" in your web.config, and you have attached Visual Studio to the web site (either by pressing F5 in VS with the project loaded, or through "Debug | Attach to process...")?

Are you building a Web Application (you have to compile the project to see changes in code, you have a /bin folder in the root with a dll in in) or a web site (you don't have to compile things, you have an /app_code folder for shared classes, etc).

Zhaph - Ben Duguid
breakpoint is not hitting any of above functions. How to do that. If i post breakpoint on page load, it is not getting hit.
Mohan Sharma
any help it's urgent???????????????????????
Mohan Sharma
You are running with Debug compilation, `debug="true"` in the web.config and Visual Studio is attached to the web site?
Zhaph - Ben Duguid
Yes debug="true"
Mohan Sharma
Have you set it to autoeventwireup = true?
SLC
A: 

any help will be appreciated.

Mohan Sharma