?
Solved

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

Posted on 2012-04-12
4
Medium Priority
?
392 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 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