Bug In VS2008

Discussion in 'ASP .Net' started by Lars, Feb 26, 2008.

  1. Lars

    Lars Guest

    Hi

    This is how the problem was solved.

    protected void GridView1_SelectedIndexChanged(object sender,
    EventArgs e)
    {
    FormView FV;
    GridView GV = sender as GridView;

    if (GV != null)
    {
    //FV = (FormView)
    FV = (FormView)GV.Parent.FindControl("fvMP3URL");

    if ((FV != null))
    {
    FV.PageIndex = GV.PageIndex * GV.PageSize +
    GV.SelectedIndex;
    }
    }
    }

    Again, thatnks for your help George.

    Lars


    ----- Original Message -----
    From: "Lars" <>
    Newsgroups: microsoft.public.dotnet.framework.aspnet
    Sent: Tuesday, February 26, 2008 3:55 AM
    Subject: Re: Bug In VS2008


    > Hi
    >
    >
    > Tried the following but it didn't work. Took a look at
    > http://msdn2.microsoft.com/sv-se/library/31hxzsdw(en-us).aspx
    >
    > protected void gvMP3URL_SelectedIndexChanged(object sender, EventArgs e)
    > {
    > LinkButton LB;
    > FormView FV;
    > GridView GV;
    >
    > LB = sender as LinkButton;
    > if (LB != null)
    > {
    > // The name of the controlls was Copies and paisted!
    > FV = (FormView) LB.Parent.FindControl("FormView1");
    > GV = (GridView) LB.Parent.FindControl("gvMP3URL");
    > if ((FV != null) && (GV != null))
    > {
    > FV.PageIndex = GV.PageIndex;
    > }
    > else
    > {
    > Label1.Text = "Could not find fvMP3URL or gvMP3URL";
    > }
    > }
    > else
    > {
    > // This is what is the line I reach.
    > Label1.Text = "Could not identify sender as LinkButton";
    > }
    > }
    >
    >
    >
    > Tanks George.
    > Lars
    >
    > "George Ter-Saakov" <> skrev i meddelandet
    > news:%...
    >> It's quite understandable that those controls are not accessible from
    >> runtime..
    >>
    >> It's exactly the same as if you have UserControl that has txtInputBox on
    >> a
    >> page and then be surprised that you do not have access to txtInputBox
    >> from
    >> the page level..
    >>
    >>
    >> VS 2008 (and .NET) does not know how LoginView control work. It might
    >> work
    >> as datagrid for example and multiple the LoggedInTemplate thousand
    >> time.... then what???
    >>
    >> Your soulution would be to use FindControl...

    >
    >>
    >> George.
    >>
    >>
    >>
    >>
    >> "Lars" <> wrote in message
    >> news:t5nwj.4189$...
    >>> Hi
    >>>
    >>> I fear that I have stumbled on to a bug in VS2008. I have controlls
    >>> added
    >>> to a page that is within a MasterPage and when I try to access the
    >>> controls from the .cs file the compiler doesn't recognize the control
    >>> members.
    >>>
    >>> I have this in my aspx file.
    >>>
    >>> <asp:LoginView ID="lvMP3URL" runat="server">
    >>>
    >>> <LoggedInTemplate>
    >>>
    >>> <asp:FormView ID="fvMP3URL" runat="server" AllowPaging="True"
    >>> BackColor="White"
    >>> BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
    >>> CellPadding="3"
    >>> CellSpacing="1" DataKeyNames="URL" DataSourceID="sdsMP3Files">
    >>> <FooterStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>> <RowStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>> <EmptyDataRowStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>> <InsertRowStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>> <RowStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>> <PagerStyle BackColor="#B4B4B4" ForeColor="Black" />
    >>>
    >>> <!--Mmore defines
    >>> .
    >>> .
    >>> .
    >>> -->
    >>>
    >>> </asp:FormView>
    >>> <asp:GridView ID="gvMP3URL" runat="server" AllowPaging="True"
    >>> AllowSorting="True" BackColor="White" BorderColor="White"
    >>> BorderStyle="Ridge"
    >>> BorderWidth="2px" CellPadding="3" CellSpacing="1"
    >>> DataSourceID="sdsMP3Files"
    >>> GridLines="None">
    >>> <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
    >>> <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
    >>> <Columns>
    >>> <asp:CommandField ShowSelectButton="True" />
    >>> </Columns>
    >>> <PagerStyle BackColor="#B4B4B4" Font-Bold="True" ForeColor="Black"
    >>> HorizontalAlign="Right" />
    >>> <SelectedRowStyle BackColor="#B4B4B4" Font-Bold="True" ForeColor="Black"
    >>> />
    >>> <HeaderStyle BackColor="#B4B4B4" Font-Bold="True" ForeColor="Black" />
    >>> </asp:GridView>
    >>>
    >>> </AnonymousTemplate>
    >>>
    >>> </asp:LoginView>
    >>>
    >>>
    >>>
    >>>
    >>> The following code can't be compiled
    >>>
    >>> protected void gvMP3URL_SelectedIndexChanged(object sender, EventArgs e)
    >>> {
    >>> fvMP3URL.PageIndex = gvMP3ULR.PageIndex;
    >>> }
    >>>
    >>> I get the error2
    >>>
    >>> Error 49 The name 'fvMP3URL' does not exist in the current context
    >>> Error 50 The name 'gvMP3ULR' does not exist in the current context
    >>>
    >>>
    >>> Can some one explain why?
    >>>
    >>>
    >>> Lars
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Lars, Feb 26, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hans Kesting

    vs2008 hangs when building solution

    Hans Kesting, Sep 24, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    646
    Teemu Keiski
    Sep 24, 2007
  2. shapper

    LINQ in VS2008

    shapper, Oct 15, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    372
    Patrice
    Oct 15, 2007
  3. Lars

    Bug In VS2008

    Lars, Feb 24, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    461
  4. Lars

    Bug in VS2008

    Lars, Feb 26, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    317
  5. King Coffee

    VS2008 (Std) Bug

    King Coffee, Nov 17, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    371
    King Coffee
    Nov 17, 2009
Loading...

Share This Page