Forms Data Controls :: Hierarchical Data In Gridview From Dataset?

Mar 27, 2010

I want to display child rows in the datagrid after the + sign is selected (like grouping & outlining in excel). This is automatic in infragistic grids but when i did in asp (no more infragistics) it doesnt work. here is my code (very simple stuff)

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
DataSet ds = new DataSet();
ds.Tables.Add(myDataAccess.ExecuteSelectCommand("uspCategories"));
ds.Tables[0].TableName = "tblCategories";
ds.Tables.Add(myDataAccess.ExecuteSelectCommand("uspProducts"));
ds.Tables[1].TableName = "tblProducts";
DataRelation rel = new DataRelation("relation", ds.Tables[0].Columns["CategoryID"], ds.Tables[1].Columns["CategoryID"]);
ds.Relations.Add(rel);
GridView1.DataSource = ds;
GridView1.DataBind();

View 3 Replies


Similar Messages:

Forms Data Controls :: Make A Hierarchical Gridview With 1 Freeze Column?

Dec 4, 2010

I want to make a hierarchical gridview with 1 freeze column.

i have freeze a column in general gridview but it was not working on internet explorer 8.

View 3 Replies

Forms Data Controls :: Hierarchical GridView And Payment Button Firing Multiple Times

Feb 23, 2011

I have developed an application using Visual Studio 2008. I have a hirerchical gridview and on every row i have a "Payment" button which actually inserts a payment entry in database. Here is the sample screen of that gridview so u have an idea what i am doing. Problem is that whenever user pressed the button of "PAYMENT" it is inserting multiple records in database..it should only fire once and i am failed to understand why its firing multiple times. Refer this link for my payment screen: [URL]

[Code]....

My code behind--------------------

[Code]....

View 3 Replies

Forms Data Controls :: Hierarchical Data Display And Hopefully Update?

Mar 29, 2010

When a user updates a record via detailsview in table 1 (TA), I need to display child records which are in table 2 (SG) and their child records which are in table 3 (SC). I tried to use DataList inside another DataList but I cannot filter the table 3 records based on returned values of table 2. I am also using TableAdapters and added a relation for table 3 to table 2 via both primary keys of table 2. I selected to create Both Relation and Foreign Key Constraint and Cascade as Accep/Reject Rule.

For my select statement on table 2, I filter it via WHERE (SGPrimaryKeyCd = :SGPrimaryKeyCd) AND (SGPrimaryKeyDate = :SGPrimaryKeyDate) and return the correct records based on values entered by the user.

For my select statement on table 3, I tried using a WHERE clause but didn't work. Without a Where clause I get all the records, of course. I thought relation would take care of filtering.

[Code].....

View 2 Replies

Forms Data Controls :: How To Display Data In Hierarchical Format

Dec 28, 2010

This maybe simple thign to you but I need to display data in below hierarchical format. I am using ASP.NET, VB.NET.

Company
- Product1
- Product2
- Product3
- Product4

There will be only 1 root node (Company) in my case. And it will have 1 or more child nodes. These child nodes will not have any further child, ie they are leaf nodes.

How to display this data in this format using ASP.NET & VB.NET?

View 1 Replies

Forms Data Controls :: Retrieving And Displaying Hierarchical Data?

Jul 21, 2010

I'm in the process of developing a survey system. The tables / fields that are related to my question are:

[Code]....

My issues with this way were:

1) The Data Adaptors receive ALL the records from their correspondent tables. Not a good practice, I believe.

2) If, at some point, the survey had no categories, questions or choices under its child records, an error occurs when the page tries to build the Data Relation. With the work flow I had in mind for the system, this is bound to happen becuase all the Data entry pages (Add Category, Add Question, Add Choice) will be displaying the newly-created survey in a similar fashion (at which point, the survey will have no child records and so an error would occur)

View 3 Replies

Forms Data Controls :: Displaying Hierarchical Data In One Row?

Feb 6, 2010

I have a gridview that displays in the following manner. What I am trying to accomplish to is if you see the columns with the heading(s) Name, LegName, MedicalConditions, DateofBirth and id displays as two rows, as it normally would, but what I would like to do is to have all that data display in ONE Row because it all belongs to one registration. If you look at the two images, image one is how the data comes out of the DB normally. Image two is how I would like to be. keep in mind that this is a small example and I actually have more fields than just this, so I am looking for something extensible. Anyone have any thoughts on how I could modify the gridview to display my data like this?

View 2 Replies

Forms Data Controls :: Detailsview Row Update / Creating Dataset, Getting Data From Sql With Adaptor And Filling Into Dataset Object

Dec 21, 2010

I have a detailsview, template as follows:

[Code]....

Codebehind: creating dataset, getting data from sql with adaptor and filling into dataset object, then setting detailsview's datasource.
I add 2 button to above template to able to edit data at asp page, and added event handlers:buttons:

[Code]....

My question is, what to do inside the detailsview update event function to able to edit and update data. My method can be wrong too.

View 7 Replies

Forms Data Controls :: Use Dataset And Datatable To Bind Data To A Gridview?

Aug 27, 2010

on which all conditions we use dataset and datatable to bind data to a gridview?

View 2 Replies

Forms Data Controls :: DataSet Populated But Data Does Not Display In GridView

Aug 23, 2010

I have the following code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Oracle.DataAccess.Client; // ODP.NET Oracle managed provider
using Oracle.DataAccess.Types;

namespace MyTestApp {
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
OracleConnection conn = new OracleConnection("User Id=UID; Password=PWD; Data Source=XE; Pooling=false"); try { conn.Open(); } catch ( OracleException oe ){
Console.WriteLine("ERROR : " + oe.Message); }
if ( !Page.IsPostBack ) {
if (conn.State == ConnectionState.Open) {
// get data GetMoleculesToShow(conn); } }
// clean up connection conn.Dispose(); }
static void GetMoleculesToShow( OracleConnection conn ){
String division; String rxotc; String molecule_name;
String prodnum; String proddesc; String molecule_class; String nonactive;
// create command object and set attributes
OracleCommand cmd = new OracleCommand("schema.package.procedure", conn);
cmd.CommandType = CommandType.StoredProcedure;
//Bind values
cmd.Parameters.Add("mol_to_show_cur", OracleDbType.RefCursor);
cmd.Parameters[0].Direction = ParameterDirection.Output; try {
// Execute command, have parameters populated cmd.ExecuteNonQuery();
// Create OracleDataAdapter, data provider object to populate dataset
OracleDataAdapter da = new OracleDataAdapter(cmd);
//Populate dataset with "molrefcur"
DataSet ds = new DataSet();
da.Fill(ds, "mol_to_show_cur", (OracleRefCursor)(cmd.Parameters["mol_to_show_cur"].Value));
//Verify dataset is begin populated //DataTable dt = ds.Tables[0];
//foreach ( DataRow dr in ds.Tables[0].Rows ) //{
// division = dr["division"].ToString();
// rxotc = dr["rxotc"].ToString();
// molecule_name = dr["molecule_name"].ToString();
// prodnum = dr["prodnum"].ToString();
// proddesc = dr["proddesc"].ToString();
// molecule_class = dr["molecule_class"].ToString();
// nonactive = dr["nonactive"].ToString(); //}
if (ds.Tables[0].Rows.Count != 0) {
// display dataset values GridView gvMolecules = new GridView();
gvMolecules.DataSource = ds.Tables["mol_to_show_cur"].Rows;
gvMolecules.DataBind(); } }
catch (OracleException oe) {
Console.WriteLine("ERROR : " + oe.Message); }
finally { cmd.Dispose(); } } } }

The dataset is being populated, however when the page renders, the data nor the gridview are visible. I have tried using both IE and Firefox, binding / not binding the columns, AutoGenerateColumns Y / N with no success. As I am new to all of this ( VS2008, ASP.NET, C# ) I can't help but to think I am overlooking something basic.

I am using the following :
- VS 2008
- MS Vista SP2
- Oracle XE ( local )

View 13 Replies

Forms Data Controls :: Bind Data From DataSet (DataTable) To A Selectrow DropDownList In GridView?

Nov 19, 2010

I have a Gridview and two link button in that GridView , one link button click is to add edit row ( Edit ), one link button click is to select row ( Select ). I have a dropdownlist inside row which selected when i click link button Select in the gridview edit template, as of my business logic i need to show the dropdownlist only when the user clicks Edit button and when the user clicks Select button . That mean when the user clicks Select button then they clicks Edit button on the gridvview i should allow him to edit the dropdownlist (showing the value to the user through a label).

ASPX CODE

[Code].... C#

When I click Select link button , then I click Edit link button . They have errors : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" I don't know what error?. How to fix it

View 3 Replies

Forms Data Controls :: Import Excel Sheet Data Into Dataset Or Gridview And Save To DB?

Mar 2, 2011

i am use this code for read excel file:

[Code]....

how to read special cells in excel and I save to DB.

for example: B4 and C4 is merged with named B4.how to read Data of this cell.

View 4 Replies

Forms Data Controls :: Insert Data From Gridview To Dataset?

Jan 19, 2010

I `m working in aprojct taht read Excel files then insert tables from excel files to dataset then display these tables into Gridview , All these ok with me

The problem here is

How to insert updated data from gridview to dataset again?

I search for it more & more but i didn`t find any thing to do it

View 10 Replies

Web Forms :: Can Read From A Dataset And Create A Hierarchical Horizontal Menu

Mar 5, 2010

Can I read from a dataset and create a hierarchical horizontal menu?

View 4 Replies

Forms Data Controls :: Binding Gridview To Dataset, Field Or Property Not Found On The Selected Data Source?

Apr 9, 2010

[Code]....

[Code]....

[Code]....

View 3 Replies

Forms Data Controls :: 3.5 Tabular DataList Hierarchical?

May 20, 2010

I want to learn how to show html in a situation of a tabular format to One To Manyto make me understand I have the categories and subcategories for each category I wish we were all subcategories.I tried with a DataList, but the categories repeated for each subcategoryIs there a way to do it. For example in asp.net mvc I wrote everything in aspx page

View 3 Replies

Forms Data Controls :: Create Hierarchical Grid Using C#?

Dec 13, 2010

how to create hierarchical grid using c#

View 1 Replies

Forms Data Controls :: Display A One Row Gridview When Gridview Is Bound To Empty Dataset

Jan 13, 2010

If the gridview binds to empty dataset, I need to still show a gridview so that users can ADD more using the textfields in the bottom of the footer template. Since the gridview is empty it won't bind not allowing rendering of the <footer template> I guess I should create a empty dataset if the gridview is empty. How do I check for this and can this be done in GridviewRowEventArgs

View 5 Replies

Forms Data Controls :: How To Create Hierarchical-master / Detail UI

Aug 11, 2010

So here is the situation - there is data on master records - its a hierarhical view - something like (ID, IDParent, Title) and detail data - (ID, IDMaster, Details)

And like to build UI using an TreeView - binded with master data - and an GridView - binded with detail data.

Question is witch property to use to create the master/detail chain between Datasources - oh, I've forgot to tell I'm using an ObjectDataSource?

View 3 Replies

Forms Data Controls :: Binding DataSet And GridView, Apply Bulk Rows Edit And Update On GridView

Dec 10, 2010

I have a set of dataset with different column retrieved from DB. I need to present the datasets in one GridView (or other ListView etc...) without specifying the column_header. It should present automaticly since the GridView is bind to the DataSet.

In additional, I want this GridView to handle multiple rows edit and update the dataset, idealy, show data in textboxs in initially.How could I set the GridView to edit_model without hardcode column_header and textboxs in 'itemtemplate' or filed.

How could I achieve the bulk edit and update, so that I can assign 'mydataview1.table' to the dataset.

View 1 Replies

Forms Data Controls :: Bind A Gridview With A Dataset?

May 6, 2010

I need to bind a gridview with a dataset souce.but this dataset source is not loaded from database.its tables are loaded manually.

now the query is - what can I give in the itemtemplate of gridview?

View 4 Replies

C# - Build Hierarchical Html List From Dataset?

Sep 14, 2010

I am getting following output in Dataset

ActivityID ParentActivityID ActivityName AcivityLevel
0 NULL Dashboard 0
1 NULL Market Trends 0
2 1 News 1

and I want to build HTML list as follow.

<ul>
<li>Dashboard</li>
<li>Market Trends[code]....

View 1 Replies

Forms Data Controls :: Return Dataset As Datasource For Gridview

Dec 5, 2010

I am trying to return a dataset. I must be doing something wrong. The returned dataset in this sample code indicates there is a datatable, Users, but there are no datarows. What am I doing wrong? This example is only using the rows.count, but of course I really need to use the whole datatable as the datasource for a gridview.

[Code]....

Public Function getmyds() As DataSet
Dim dsUser1 As DataSet = New DataSet()
Dim tbUser1 As DataTable = dsUser1.Tables.Add("Users")
tbUser1.Columns.Add("UserName")
tbUser1.Columns.Add("Days Remaining")
tbUser1.Columns.Add("UserAccountControl")
Dim rwDefaultUser1 As DataRow = tbUser1.NewRow()
rwDefaultUser1("UserName") = "John Smith"
rwDefaultUser1("Days remaining") = 100
rwDefaultUser1("userAccountControl") = "Enabled"
Return dsUser1
End Function

View 2 Replies

Forms Data Controls :: Editing A Dataset And Binding To Gridview?

Dec 28, 2010

i am fetching data in a dataset.now i m trying to modify the contents using :

For Each row As DataRow In ds.Tables(0).Rows
If row.Item(7) = False Then
ds.Tables(0).Rows.Item(6) = "`/abc/xx/" & row.Item(0)
End If
next

but, this gives me error saying roperty 'item' is read only.

View 2 Replies

Forms Data Controls :: Display A Single Row From Dataset Into Gridview

Jan 21, 2010

I need to know how to display a single row(or particular row)from dataset and display into gridview... i tried by using some codes, like the following, If strCourseLevelId <> "" Then Dim ds2 As DataSet Dim currentbundlenid As Int16 Dim prevbundleid As Int16 = "0" Dim bundlenos As Int16 = "0" Dim bundlecontent As Bundledata = New Bundledata ds2 = bundlecontent.GetBundleData(strCourseLevelId) If ds2.Tables.Count = 1 Then If ds2.Tables(0).Rows.Count > 0 Then With ds2.Tables(0) Dim strCnt As Int16 For strCnt = 0 To .Rows.Count - 1 With .Rows(strCnt) currentbundlenid = .Item("Bundleid") If currentbundlenid <> prevbundleid Then bundlenos = bundlenos + 1 End If If bundlenos = "1" Then GridView1.DataSource = ds2 GridView1.DataBind() ElseIf bundlenos = "2" Then GridView2.DataSource = ds2 GridView2.DataBind() ElseIf bundlenos = "3" Then GridView3.DataSource = ds2 GridView3.DataBind() End If prevbundleid = .Item("Bundleid") 'next write the main page content End With Next End With End If End If.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved