0

当我在 Visual Studio 2012 中处理 asp.net 页面时,我的设计和拆分按钮不见了。我只有来源。我怎样才能把这些拿回来。

4

2 回答 2

1

看看窗口的底部。看看这个问题: Visual Studio 2012 中的 Design View 去了哪里?

如果它们不存在,请启用它们: Visual Studio 2012 - ASPX 设计和拆分视图到哪里去了?

于 2013-10-20T14:20:13.553 回答
0
<TabControl TabStripPlacement="Top">
        <TabItem Header="Ex1" Width="100">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="129*"/>
                    <ColumnDefinition Width="23*"/>
                    <ColumnDefinition Width="355*"/>
                </Grid.ColumnDefinitions>
                <Button Content="Get Data" HorizontalAlignment="Left" Margin="61,22,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click" Grid.Column="2"/>
                <ListBox  Name="lbxDisplay" HorizontalAlignment="Left" Height="195" Margin="24,59,0,0" VerticalAlignment="Top" Width="456" Grid.ColumnSpan="3"/>
            </Grid>
        </TabItem>
        <TabItem Header="Ex2" Width="100">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="22*"/>
                    <ColumnDefinition Width="20*"/>
                    <ColumnDefinition Width="465*"/>
                </Grid.ColumnDefinitions>
                <Button Content="GetData2" Name="GetData2" HorizontalAlignment="Left" Margin="171,22,0,0" VerticalAlignment="Top" Width="75" Click="GetData2_Click" Grid.Column="2"/>
                <ListBox Name="lbx1" HorizontalAlignment="Left" Height="195" Margin="2,59,0,0" VerticalAlignment="Top" Width="209" Grid.Column="1" Grid.ColumnSpan="2" SelectionChanged="lbx1_SelectionChanged" />
                <ListBox Name="lbx2" HorizontalAlignment="Left" Height="195" Margin="233,59,0,0" VerticalAlignment="Top" Width="207" Grid.Column="2"/>
            </Grid>
        </TabItem>
        <TabItem Header="Ex3" Width="100">
            <Grid Margin="9,14,16,28">
                <Button Content="Get Data3"  Name="GetData3" HorizontalAlignment="Left" Margin="213,22,0,0" VerticalAlignment="Top" Width="75" Click="GetData3_Click"/>
                <DataGrid Name="dgDisplay3" Margin="0,51,0,0" RenderTransformOrigin="0.5,0.5" >
                    <DataGrid.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform AngleX="1.193"/>
                            <RotateTransform/>
                            <TranslateTransform X="-1.479"/>
                        </TransformGroup>
                    </DataGrid.RenderTransform>
                </DataGrid>
            </Grid>
        </TabItem>
        <TabItem Header="Ex4" Width="100">
            <Grid>
                <Button Content="Get Data" Name="GetData4" HorizontalAlignment="Left" Margin="213,22,0,0" VerticalAlignment="Top" Width="75" Click="GetData4_Click"/>
                <DataGrid Name ="dgDisplay4" Margin="10,62,10,10"></DataGrid>
            </Grid>
        </TabItem>
        <TabItem Header="Ex5" Width="100">
            <Grid>
                <Button Content="Get Data"  Name="GetData5" HorizontalAlignment="Left" Margin="213,22,0,0" VerticalAlignment="Top" Width="75" Click="GetData5_Click"/>
                <DataGrid Name ="dgDisplay5" Margin="10,62,10,10"></DataGrid>
            </Grid>
        </TabItem>
    </TabControl>




   //1. Retrieve customer names and display alphabetically in a listbox 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var query = from c in db.Customers
                        orderby c.ContactName ascending
                        select c.ContactName;

            lbxDisplay.ItemsSource = query.ToList();
        }


        //2.(a) One on left displays supplier name.  
        private void GetData2_Click(object sender, RoutedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var query = from s in db.Suppliers
                        select s.CompanyName;

            lbx1.ItemsSource = query.ToList();
            lbx1.SelectedIndex = 0;
        }
        //(b) When a name is selected on this list the products for this supplier are displayed on the right
        private void lbx1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            string companyName = lbx1.SelectedValue.ToString();
            var query2 = from s in db.Suppliers
                         join p in db.Products
                         on s.SupplierID equals p.SupplierID
                         where s.CompanyName == companyName
                         select p.ProductName;

            lbx2.ItemsSource = query2.ToList();
        }


        //3. Select the following product information and display on a DataGrid
        //Product Name //Supplier Name //Unit Price
        private void GetData3_Click(object sender, RoutedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var query3 = from s in db.Suppliers
                         join p in db.Products
                         on s.SupplierID equals p.SupplierID
                         select new
                         {
                             Name = s.CompanyName,
                             Product = p.ProductName,
                             Price = p.UnitPrice
                         };

            dgDisplay3.ItemsSource = query3.ToList();
        }


        //4. Display Customer ID and Number of Orders sorted with highest number of orders first
        //using Orderby
        private void GetData4_Click(object sender, RoutedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var query4 = from o in db.Orders
                         join od in db.Order_Details
                         on o.OrderID equals od.OrderID
                         orderby od.Quantity descending

                         select new
                            {
                            CustomerId = o.CustomerID,
                            NumberofOrders = od.Quantity,
                            }; 

            dgDisplay4.ItemsSource = query4.ToList();
        }


        //5. Display the following information from the Orders and Customer tables ordered by count of orders
        // Customer ID // Company Name // Number of Orders // Contact Name // Contact Phone
        //Hint: Use Group and Join
        private void GetData5_Click(object sender, RoutedEventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var query5 = from o in db.Orders
                         group o by o.CustomerID into g
                         join c in db.Customers on g.Key equals c.CustomerID
                         orderby g.Count() descending

                         select new
                         {
                             CustomerId = g.Key,
                             CompanyName = c.CompanyName,
                             OrderCount = g.Count(),
                             ContactName = c.ContactName,
                             ContactPhone = c.Phone
                         };
            dgDisplay5.ItemsSource = query5;
        }


    }//end class
于 2014-05-04T19:14:03.603 回答