.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Webform Grid Control With Varying Columns

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

I will do my best to explain what I am trying to accomplish.  I am trying to create a recipe system that will pull material amounts from an already built inventory database upon request for testing purposes of the different recipe runs.  What is throwing me for a loop is that each time a user will request a recipe comparison they will have a different number of recipe trial runs for comparison purposes.  In order to do this I'm guessing you will need to generate a gridview-like control with a dynamic number of columns which would be specified on a web form page prior to arriving at the recipe formulation page which will contain the control for the recipe formulation.  As a result the user will have different columns and rows on this formulation page, with the rows being a static number of 30 (30 being maximum amount of ingredients to include in each recipe).  The columns will contain the recipes to be compared, i.e. ProductRun1, ProductRun2, ProductRun3, where the number of ProductRunX will be determined by user input.  So the user when they come to this aspx page will be presented with a blank editable grid of X columns by 30 rows deep.  The left-most column will contain the ingredient names in a drop down box for users to select to input into their recipe and the rest of the columns will be editable fields where the user can type in t

View Complete Post

More Related Resource Links

Cutting Edge: A New Grid Control in Windows Forms


Grid controls are essential in many of today's apps. Until now, though, most developers using Visual Basic® have had to buy third-party components to get an effective, easy to use grid component. The Windows® Forms DataGrid turned out to lack too many features for the average developer.

Dino Esposito

MSDN Magazine April 2005

Grid control displays a hyperlink. (in WPF)

Hello, I'm making application, that's received a text from web.   get the text following the code is shown below.   For Each Status As Status In A.GetList grdList.RowDefinitions.Add(New RowDefinition() With {.Height = GridLength.Auto}) Dim TextBlock As New TextBlock() TextBlock.Margin = New Thickness(4) TextBlock.TextWrapping = TextWrapping.Wrap TextBlock.Inlines.Add(Status.Text) Grid.SetColumn(TexatBlock, 1) Grid.SetRow(TextBlock, grdList.RowDefinitions.Count - 1) grdList.Children.Add(TextBlock) Next TextBlock is added, the grid view control does not display a hyperlink. So, Does not display the URL as a hyperlink. What should I do in the grid control will display the URL as a hyperlink? plz, help me

Image stretch inside a grid stops working horizontally once columns are added to grid.

I have a simple setup of a window. Window contains a grid, inside the grid there is an image. I want the image to always stretch across the entire cell. I've set it's Stretch property to Fill and it works fine, as long there is only one column in the parent grid. As the window is resized, the image stretches correctly. As soon as I add another column, the image stops stretching horizontally. Vertially it works just like before, horizontally it now appears with a fixed width corresponding to the width of the picture used as the source. Does not matter which column it's positioned in, and I've tried encapsulating it into another grid but behaviour does not change. It behaves the same in both Visual studio 2010 designer and at runtime. In addition when I tried to encapsulate it in a second grid, this seond grid also now has altered behavior - instead of sizing itself to it's container (both height and width are not set) as it's parent grid does, it now sizes itself to its contents - the image. But only horizontally. What is going wrong here, is this a bug or am I missing something, and any advice on how I can get the image to fill one of the cells of a grid with more then one column?

Add TextBoxes and Grid in Single WebForm.

Hi All,   Actually i want to create Invoice Web Form Using C#, Asp.Net.But I have no idea about how to add grid view and text boxes in single form. As Text Boxes of Form will store in Invoice header Table and Item Which i have added in that should store in Item Table. (if you have any other suggestion for db structure please suggest me.)  This Form will have 8 Textboxes beside gridview and one gridview. TextBoxes are as below:- 1)Invoice Number(AutoNumber). 2)Invoice Date(will be filled Manually). 3)Customer Name(DropDown or AutoComplate TextBox). 4)Customer Address (Will  be filled as i select Customer). 5)Customer Representative(Will be Dropdown list or Auto Complete TextBox and will be filtered on Customer Name). 6)"Create" Button (It will fill the above TextBoxes Data In InvoiceHeader Table and Reserve Invoice Number and Catch ID of Invoice Number to use for Grid View.)   When I click Create Button System Will also Show me the Hidden GridView and Attached TextBoxes to Fill data in Grid. There will be  textboxes.   1) Item Code (Will be AutoComplete TextBox and Data Will be retrived from ItemTable and Only Pick Items Which are in Stock.) 2) Item Name (Will be autofilled when i select Item Code.) 3) Item Qty(Will be autofilled when i select Item Code.) 4) Item Stock Date (Will be autofilled when i select Item Co

Dynamic Columns Using Report Viewer Control

Hi,, I'm using Report viewer Control to generate reports.Currently i have static columns..I need to have columns created  based on the DB Query  results i.e., DB query will return more columns under certain conditions and less columns in another...In Short,Headers and column data will be known only at runtime.how can i bind the data dynamically...what can i do to accomplish this..

Unable to store combo box value to data grid view control

Hello,         I am using fw 3.5 SP1 with VS2008. I have bind my object collection with data grid view. I can see different values in combo box inside data grid view. But when I select any one value from combo box the selected value is changed to first value of combo box as soos as user leave the cell of the gird. Can anyone tell me where should I look for this problem so that my selected value remains same as user did select it.   Nilkanth Desai  


the database result is as follows DATE     code   class1 class2  class3 1/8/10     M1     10       20     30     3/8/10     V2      20       30     10      1/8/10      H1      1           2      3         7/8/10     ! ! 8/8/10     !M2    5      5      5       3/8/10     B2      4      4     4       1/8/10     V1      3      7     3       THE OUTPUT SHOULD BE AS FOLLOWS:- DATE           M1                          M2           

Grid view control problem

HiI am using the grid view control where i am using <asp:CommandField for editing & deleting i want to visible false of this coloumn with edit & delete button..how do this.Thanks<asp:GridView DataKeyNames="StaffCalendarId"  PagerSettings-Mode="NumericFirstLast"                                                        PagerStyle-HorizontalAlign="Center" ShowHeader="true" AllowPaging="true" AutoGenerateColumns="False"                                                        Width="100%" ID="gvEventInfo" runat="server" CellPadding="4" ForeColor="#333333"                            &nbs

windows control library not loading webform

Hi Am using asp.net 2.0 .i am having a windows control library.dll in my webform ,but it is not loading correctly.i have attached the code below. <form id="form1" runat="server">  <object classid="http:controllibrary.dll#controllibrary.UserControl1" id= "myid" height="450" width="800" VIEWASTEXT> </object>  </form> please help me.

How to use CSS to style just one of the columns in a GridView control

<asp:Boundfield Datafield="City" Headertext="City" sortexpression="City" CONTROLSTYLE-CSSCLASS="allcaps"/> I'm trying to use the CSS property "text transform" to make just one specific GridView column "all caps" (see above), but it has no effect. It only works when I place the reference to the class ".allcaps"  in the main tag at the top of the GridView control---but that makes all columns "all caps". How can I style just one column using CSS?   Thanks.  

Regarding Use Of Rad Grid Telerik control

I am using Telerik Rad Grid Control in my Sharepoint While creating Custom field type . I downloaded Telerik Rad Controls for ASP.Net AJAX Q2 2010 SP1.and put my telerik.web.config.UI in GAC .I added in web.configthe safe controls < SafeControl Assembly="Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TypeName="*" Safe="True" /> < SafeControl Assembly="Telerik.Web.UI, Version=2010.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.Design" TypeName="*" Safe="True" /> and in my .ascx file I added this thing: <% @ Register assembly="Telerik.Web.UI, Version=2010.1.309.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"   namespace="Telerik.Web.UI" tagprefix="telerik" %> and I am getting this error please tell me where is tha problem .   File Not Found.   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)    at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark

how to give grid columns dinamically?

I am  trying to given Columns dinamically but this is not woking . pls help me

Trying to incorporate the use of a dropdown list control with a grid view control


I'm trying to setup a page that will utilize a dropdown list control inside of a grid view control using VS 2005 2.0 version. Everything that I can find online seems to only show the use of the dropdown list control using a data grid. I don't want to use a data grid because it doesn't have the functionality/ power as the grid view control. Can someone please tell me how I can incorporate a dropdown list control with the grid view control? Here is a copy of my code.

<asp:GridView ID="HardwareSetdv" runat="server" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="AcctID"
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="HardwareSetID" HeaderText="HardwareSetID"
                InsertVisible="False" ReadOnly="True" SortExpression=&quo

How can I access a webform control from another external class/namespace?


Currently, I have many controls and objects such as Chart1 of mschart as part of the public partial class _Default : System.Web.UI.Page.

At the bottom, I've created a second class that is not part of the _Default webform class.  How can I access the webform controls from this second class?

For example, I want to do

Chart1.Series["Series1"].Points.AddXY((pointIndex + 1) * 40, datapoints[pointIndex]);

I want to pass pointIndex integer and the datapoints array.

I know that Chart1 was created protected global access modifier in the designer.cs but when I changed it to public, it still had a problem.


Creating a pivot of a collection and displaying it in a databound grid with dynamic columns



I'm trying to create a pivot of some data that I have about translation.

Basically what I have now is a collection of "Translation" objects which look like that :

Public Class SystemText
  Inherits Entity

#Region "Private variables"
  Private _textCategory As String
  Private _textName As String
  Private _languageCode As String
  Private _description As String
#End Region

#Region "Properties"
  Public Overridable Property TextCategory() As String

problem in selecting deslecting multiple records in grid view by clicking control key.plz help


i want to select/deselect multiple records inside grid view by clicking control key.I can do the selection but the deselection is not working properly..there is some thing wrong in the  logic.plz help me to solve the problem.

my java script function is like..

<script language="javascript" type="text/javascript">

    function FillColor(cellid, id, evt) {
        var isSelected = document.getElementById('<%=hidSelectedRow.ClientID%>');
        if (!evt) var evt = window.event;
        ctrlPressed = evt.ctrlKey;
        if (!ctrlPressed) {
            var clearCellColor = document.getElementById('hidCellId').value.split(',');
            for (i = 0; i < clearCellColor.length; i++) {

HELP ! - how to disable spesific control inside the grid view



I need to disable the "Imagebuttons" after the user click on one of them... I've sucessfully updated the table when the user click on a button using the following code on the event of row command of the gridview...


if (e.CommandName == "voter_up")
            SqlCommand voteup = new SqlCommand("update arto_comments set voteup = voteup+1 where cid=" + e.CommandArgument, con);
            SqlCommand getVup = new SqlCommand("select voteup from arto_comments where cid =" + e.CommandArgument, con);
            //lblvoteup.Text = Convert.ToString(getVup.ExecuteScalar());
            //GridView1.Rows[1].FindControl("ImageButton1"). = false;
            ImageButton1.Enabled = false;

so please how may I disable these buttons after database is updated ?

Thanx and Regards

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend