?
Solved

How to use LiveView in C# webform to display some fields vertically and some horizontally within in one table as a fill out form?

Posted on 2014-09-14
6
Medium Priority
?
562 Views
Last Modified: 2014-10-16
I have a ListView (or GridView) draft table like this:


My SQL Server table has the following fields:

- UPC (bigint)
- Description (varchar)
- Promo_Type_AmountOrPercentage (varchar)
- Discount_Amount (float, decimal(2))
- Monthly_AdType (varchar)
- Weekly_AdType (varchar)
- Month_Number (int)
- Week_Number (int)

I need to enable the Edit function on this ListView (or GridView) for users to input the values of these 4 fields.
- Promo_Type_AmountOrPercentage (varchar)
- Discount_Amount (float, decimal(2))
- Monthly_AdType (varchar)
- Weekly_AdType (varchar)

Only the Month columns (Jan - Dec) can have the Monthly_AdType value;
and only the Week columns (1 - 52) can have the Weekly_AdType value.

The Promo_Type_AmountOrPercentage field only has two values (the dollar sign or percentage). User selects $ or % from the DropDownList.


The Monthly_AdType and Weekly_AdType also are in DropDownList.

Only the Discount Amount is as textbox for users to input the amount (in 2 decimals).

The headers highlighted in lightblue is vertial. The top headers are horizontal.

If more UPC numbers exist, there are more records displayed.

Questions:
1.
Is this kind of ListView (GridView) possible to create?

2.
Do I need to combine ListView and Repeater and JavaScript to accomplish?

3.
I know in the front-end HTML side, UPC and Description can be set to not editable. Are there any examples or references that have both vertical and horizontal headers in the same table?

Please let me know if more detail need to be provided.
Thanks.
0
Comment
Question by:Daniel Chen
[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
  • 3
6 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 40344026
You should be able to embed any control in a TemplateField, as in this example:

 <asp:TemplateField HeaderText="columnItems">
        <ItemTemplate>
            <asp:ListView ID="listOfItems" runat="server" DataSourceID="MyObjectDataSource >
                <ItemTemplate>
                    <asp:LinkButton ID="MyLinkButton" Runat="Server" Text='item'></asp:LinkButton>
                </ItemTemplate>
            </asp:ListView>
            <asp:ObjectDataSource ID="MyObjectDataSource" runat="server"   
                TypeName="MyTypeName.Whatever" SelectMethod="GetItems">
                <SelectParameters>
                    <asp:Parameter Name="requestId" Type="String" DefaultValue='<%# Eval("ID")'/>
                </SelectParameters>
            </asp:ObjectDataSource>
        </ItemTemplate>
    </asp:TemplateField>

Open in new window


and bind the ListView in the GridView_RowDataBound, as here:

if(e.Row.RowType != DataControlRowType.DataRow)
{
    return;
}

ListView listView = (ListView)e.Row.FindControl("listOfItems");
listView.DataSource = ??
listView.DataBind();

Open in new window

0
 
LVL 40

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 1000 total points
ID: 40344124
there is an

<asp:GridView> control which can do what you're looking for.

Within the columns, using the template fields as TheLearnedOne suggested is the correct way to go.

No need for a repeater.

A horizontal header to me would just be an additional column.  You can use events like the onRowDatabound to set that column to whatever value you need it to be.

Feel free to ask more questions if you need further explanation.
0
 

Author Comment

by:Daniel Chen
ID: 40344228
Thank you for the long-awaited tips.
I'm still quite new in the ASP.NET area.
Could you provide a simple demo example (code and screenshot)?

I am under the trail 30-day account so please provide more detailed answers that can really help me solve my question.
so i may consider if it's really worth it to pay monthly fees to use this website.

a simple tutorial or example like this would be appreciated:
http://aspsnippets.com/Articles/Enable-Disable-ASPNet-Validator-Client-Side-Validation-using-JavaScript-or-jQuery.aspx
http://www.aspforums.net/Threads/197148/How-to-use-ConfirmButtonExtender-conditionally-in-aspnet/
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 40344250
Can you gives us more of an idea of what you're looking for?  

Even if you doodle up something in paint and post a clip we can better answer your question.

This shows you how to style the gridview for a more professional look and feel:

http://www.etechpulse.com/2013/08/asp-gridview-css-style-sample-user.html


and a good article on using template fields:
http://msdn.microsoft.com/en-us/library/bb288032.aspx
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

770 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