Results 1 to 16 of 16

Thread: Multiview control

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Multiview control

    I am learning MultiView control.
    Here are question:
    I added 5 views in the MultiView but all views are tight together.
    I can not drag and drop another control such as text boxes or labels into view area.
    How to fix it?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Multiview control

    Hello there,

    Can you help us by providing screen shots of what you are seeing, and also the code that you are using?

    That is the best way for us to provide assistance.

    Gary

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Multiview control

    Here is code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <title>MultiView</title>
    <body>
    <form id="form1" runat="server">

    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
    <asp:View ID="View1" runat="server">

    </asp:View>
    <asp:View ID="View2" runat="server">

    </asp:View>
    <asp:View ID="View3" runat="server">

    </asp:View>
    </asp:MultiView>


    </form>
    </body>
    </html>

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Multiview control

    Hey,

    And what about a screen shot?

    A picture can say a 1000 words.

    Gary

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Multiview control

    I attached screen shot
    Attached Images Attached Images  

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Multiview control

    So, what exactly is the problem?

    What you are showing is the designer for the MultiView. This shows you a design time view of each view, meaning that you can drag and drop controls into the View, or you can add this in directly in the ASPX markup as well.

    If you run the page as is, you will only see the contents of the first view. You will need to add additional controls to toggle the current view.

    I would suggest that you have a look here:

    http://quickstarts.asp.net/QuickStar...multiview.aspx

    This shows how to use a DropDownList to toggle between the views.

    Gary

  7. #7
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Multiview control

    hay aspfun,
    could you please use the code tags when you post codes or markup
    thanks
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  8. #8
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Multiview control

    hay again,
    could you do such a thing and try to see what will happen in the Design mode for your page ?


    Code:
    <&#37;@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <title>MultiView</title>
    <body>
    <form id="form1" runat="server">
    
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
    <asp:View ID="View1" runat="server">
    <asp:TextBox ID="text1" runat="server" />
    </asp:View>
    <asp:View ID="View2" runat="server">
    
    </asp:View>
    <asp:View ID="View3" runat="server">
    
    </asp:View>
    </asp:MultiView>
    
    
    </form>
    </body>
    </html>
    maybe you drag and drop in the wrong way, i mean maybe you try to drop the control inside the MultiView tags not in the View tags
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Multiview control

    The problem is from the sample
    http://quickstarts.asp.net/QuickStar...multiview.aspx

    It is very dificulty to add another text box under (not next to the button) textbox1 in view1. The code like below only add textbox2 next to the button1.

    <asp:View ID="View1" runat="server">
    Now showing View #1<br />
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><strong> </strong>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

    </asp:View>

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Multiview control

    Hey,

    This isn't a problem with the MultiView, but rather a problem with the way that you are doing it.

    By default, controls are going to want to flow, one after the other. Just because you put the text that is the control on a new line, doesn't mean that it will appear on a new line.

    As a simple example try this:

    Code:
    <asp:View ID="View1" runat="server">
    Now showing View #1<br />
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br />
    <asp:Button ID="Button1" runat="server" Text="Button" /> <br />
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    
    </asp:View>
    All three textboxes should now be on separate "lines".

    I would encourage you to read up about using CSS to control the layout of your pages.

    Gary

  11. #11
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Multiview control

    hay,
    you can use html table to help you in the layout of the page
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Multiview control

    avrail, I just think of using html table.
    Do you have a link for a sample?

  13. #13
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Multiview control

    I would really suggest that you stay away from using a table to control your layout.

    Although this might seem like an obvious solution, you WILL run into problems down the line. I would highly recommend that you use CSS to control the layout of the controls on your page.

    Gary

  14. #14
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Multiview control

    hay,
    use this
    Code:
        <asp:View ID="View1" runat="server">
            <table>
                <tr>
                    <td colspan="3">
                        Now showing View #1
                    </td>
                </tr>
                <tr>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>    
                </td>
                <td>
                <asp:Button ID="Button1" runat="server" Text="Button" />
                </td>
                <td>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                </td>
                </tr>
            </table>
        </asp:View>
    but really i don't know exactly what the layout you want to do
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  15. #15

  16. #16

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Multiview control

    I found that real problem is adding a control which has style. For example, if I add the label below in view1, the layout is fine but if adding in view3, I need to ajust top value. It does not follow "drag and drop".

    <asp:Label ID="order" runat="server" Font-Size="Small" ForeColor="DarkBlue" Style="z-index: 1;
    left: 9px; width: 830px; position: absolute; text-align: center; height: 30px;
    top: 183px;"></asp:Label>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width