Solved

How to Get the layout in gridview asp.net, c#

Posted on 2012-04-12
4
383 Views
Last Modified: 2012-08-13
I have a gridview that displays the data. I have  a Language column. How to split the Language column into two. Please see the attachment. How to get the layout of Language in gridview?


Thanks
layout.doc
0
Comment
Question by:Saroj13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37840212
visit this :  
http://forums.asp.net/t/1322532.aspx/1

Hope this would help you!!
0
 

Author Comment

by:Saroj13
ID: 37840337
Hi,

My current gridview. Below is my code. Currently, I am having two columns: one for english and spanish. How to implement so that it will be similar to layout.
 <asp:GridView Width="100%"
                                            AllowPaging="False"
                                            ID="gvScript"                                           DataKeyNames="Script_ID" Font-Size="X-Small"    
                                         
                                            OnRowDataBound="ScriptsGridView_RowDataBound"
                                            AutoGenerateColumns="False"
                                            DataSourceID="scriptsSource"  
                                            AutoGenerateEditButton="False"
                                            runat="server" >
                                           
                                            <Columns>
                                                <asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="Left" SortExpression="Script_ID" >
                                                  <ItemTemplate>
                                            <asp:HyperLink  ID="hlFullEditModeLink"  runat="server"  NavigateUrl='<%# "EditScrip1.aspx?Script_ID=" + Eval("Script_ID")%>'  Text = '<%# Eval("Script_ID")%>'  />
                                     
                                                  </ItemTemplate>

                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Title" ItemStyle-Width="300px" HeaderStyle-HorizontalAlign="Left" SortExpression="ScriptTitle">
                                                  <ItemTemplate>                                    
                                                   <%# Eval("ScriptTitle")%>
                                                  </ItemTemplate>
                                                                                              </asp:TemplateField>
                                                               
         
                                                  <asp:TemplateField HeaderText="English">
                                                   <ItemTemplate>
                                                    <img src='../images/<%# GetImageNameForEnglishText(Container.DataItem) %>' />
                                                 </ItemTemplate>
                                                 </asp:TemplateField>
                                               

                                                  <asp:TemplateField HeaderText="Spanish">
                                                 <ItemTemplate>
                                                   
                                                       <img src='../images/<%# GetImageNameForSpanishText(Container.DataItem) %>' />
                                                  </ItemTemplate>
                                                </asp:TemplateField>
                                                 
</asp:gridview>
0
 
LVL 12

Accepted Solution

by:
AshleyBryant earned 500 total points
ID: 37841057
Based on what you have provided and the link that Lalit-Chandra gave, you would need to do something like this in your rowdatabound event in the code-behind.

protected void ScriptsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
            TableCell cell1 = new TableCell();
            cell1.ColumnSpan = 2;
            row.Cells.Add(cell1);

            TableCell cell2 = new TableCell();
            cell2.ColumnSpan = 2;
            cell2.Text = "Language";
            row.Cells.Add(cell2);

            ScriptsGridView.Controls[0].Controls.AddAt(0, row);
        }
    }

Open in new window

0
 
LVL 2

Expert Comment

by:Codecaesar
ID: 37848124
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question