Solved

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

Posted on 2012-04-12
4
387 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] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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!
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 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