Click here to Skip to main content
15,891,136 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: vs2003 and vs2005 Pin
Christian Graus11-Feb-08 18:07
protectorChristian Graus11-Feb-08 18:07 
GeneralRe: vs2003 and vs2005 Pin
Gandalf_TheWhite11-Feb-08 18:45
professionalGandalf_TheWhite11-Feb-08 18:45 
GeneralRe: vs2003 and vs2005 Pin
dilipv11-Feb-08 19:14
dilipv11-Feb-08 19:14 
QuestionWWW in URL breaks ASP .Net Script ? Pin
Mitch F.11-Feb-08 16:27
Mitch F.11-Feb-08 16:27 
GeneralRe: WWW in URL breaks ASP .Net Script ? Pin
Christian Graus11-Feb-08 18:08
protectorChristian Graus11-Feb-08 18:08 
GeneralRe: WWW in URL breaks ASP .Net Script ? Pin
Mitch F.11-Feb-08 18:58
Mitch F.11-Feb-08 18:58 
GeneralRe: WWW in URL breaks ASP .Net Script ? Pin
Mitch F.11-Feb-08 19:30
Mitch F.11-Feb-08 19:30 
General3 level datagrid drill down Pin
uglyeyes11-Feb-08 12:59
uglyeyes11-Feb-08 12:59 
Hi!

I have wasted lots of time. could someone please advise if its possible or not so that i could start thinking of alternative solution. I am trying to build a tree level datagrid. the datastructure looks something like below.

1 Vehicle

2 Clothing

1 Holden

2 Pants

1 Barina

2 Astra

3 Jeans

4 Cotton

ASPX

<asp:DataGrid id="dgA" DataKeyField="aid" runat="server" Width="100%" AutoGenerateColumns="False">

<Columns>

<asp:BoundColumn DataField="aid" HeaderText="Id" Visible="false"></asp:BoundColumn>

<asp:TemplateColumn>
<ItemTemplate>

<asp:ImageButton id="btnA" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandA"></asp:ImageButton>

</ItemTemplate>

</asp:TemplateColumn>
<asp:BoundColumn DataField="aname" HeaderText="Name"></asp:BoundColumn>

<asp:TemplateColumn>

<ItemTemplate>

<asp:PlaceHolder ID="phExpandA" Runat="server" Visible="False">

</td></tr>

<tr><td >&nbsp;</td>

<td colspan="11">

<asp:DataGrid id="dgB" DataKeyField="bId" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>

<asp:BoundColumn DataField="bid" HeaderText="Id" Visible="false"></asp:BoundColumn>

<asp:TemplateColumn>
<ItemTemplate>

<asp:ImageButton id="btnB" runat="server" Width="9px" Height="9px" ImageUrl="/Images/Plus.gif" CommandName="ExpandB"></asp:ImageButton>

</ItemTemplate>

</asp:TemplateColumn> <asp:BoundColumn DataField="bname" HeaderText="Name"></asp:BoundColumn>
<asp:TemplateColumn>

<ItemTemplate>

<asp:PlaceHolder ID="ExpandB" Runat="server" Visible="False">

</td></tr>

<tr><td >&nbsp;</td>

<td colspan="11">

<asp:DataGrid ID="dgC" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>

<asp:BoundColumn DataField="cId" HeaderText="Id" ItemStyle-Wrap="true">
</asp:BoundColumn>

<asp:BoundColumn DataField="cName" HeaderText="Name" ItemStyle-Wrap="true">
</asp:BoundColumn>

</Columns>
</asp:DataGrid>

</asp:PlaceHolder>

</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:DataGrid>

</asp:PlaceHolder>

</ItemTemplate>

</asp:TemplateColumn>

</Columns>
</asp:DataGrid>



VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim conn As New SqlConnection("...")

Dim cmd As SqlCommand = conn.CreateCommand()
Dim dsA As New DataSet

Dim daA As SqlDataAdapter
cmd.CommandText = "select * from A"

conn.Open()

daA = New SqlDataAdapter(cmd.CommandText, conn)
daA.Fill(dsA)

If Not dsA Is Nothing Then

'fill parent datagrid

If Not IsPostBack Then

dgA.DataSource = dsA

dgA.DataBind()

End If

End If

End Sub

Private Sub dgA_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgA.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

Dim dgGridB As DataGrid = CType(e.Item.FindControl("dgB"), DataGrid)
AddHandler dgGridB.ItemCommand, AddressOf dgGridB_ItemCommand

Dim conn As New SqlConnection("...")
Dim cmd As SqlCommand = conn.CreateCommand()

Dim dsB As New DataSet Dim daB As SqlDataAdapter
cmd.CommandText = "select * from B"

conn.Open()

daB = New SqlDataAdapter(cmd.CommandText, conn)
daB.Fill(dsB)

If Not dsB Is Nothing Then

dgGridB.DataSource = dsB

dgGridB.DataBind()

End If

End If

End Sub

Private Sub dgA_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgA.ItemCommand Select Case e.CommandName
Case "ExpandA"

Dim img As ImageButton img = e.Item.Cells(1).FindControl("btnA")
If img.ImageUrl = "/Images/Plus.gif" Then

img.ImageUrl = "/Images/Minus.gif"

Else

img.ImageUrl = "/Images/Plus.gif"

End If

Dim phExpandSummary As PlaceHolder
phExpandSummary = e.Item.Cells(1).FindControl("phExpandA")

phExpandSummary.Visible = Not phExpandSummary.Visible
End Select

End Sub

Private Sub dgGridB_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
'TODO

Select Case e.CommandName
Case "ExpandB"

Dim img As ImageButton img = e.Item.Cells(1).FindControl("btnB")
If img.ImageUrl = "/Images/Plus.gif" Then

img.ImageUrl = "/Images/Minus.gif"

Else

img.ImageUrl = "/Images/Plus.gif"

End If

Dim phExpandSummary As PlaceHolder
phExpandSummary = e.Item.Cells(1).FindControl("phExpandB")

phExpandSummary.Visible = Not phExpandSummary.Visible
End Select

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

Dim dgGridC As DataGrid = CType(e.Item.FindControl("dgC"), DataGrid)
Dim conn As New SqlConnection("...")

Dim cmd As SqlCommand = conn.CreateCommand()
Dim parentDS As New DataSet

Dim parentDA As SqlDataAdapter
cmd.CommandText = "select * from C"

conn.Open()

parentDA = New SqlDataAdapter(cmd.CommandText, conn)
parentDA.Fill(parentDS)

If Not parentDS Is Nothing Then

'fill parent datagrid

If Not IsPostBack Then

dgGridC.DataSource = parentDS

dgGridC.DataBind()

End If

End If

End If

End Sub
GeneralRe: 3 level datagrid drill down Pin
Not Active11-Feb-08 14:53
mentorNot Active11-Feb-08 14:53 
GeneralRe: 3 level datagrid drill down Pin
uglyeyes11-Feb-08 16:55
uglyeyes11-Feb-08 16:55 
GeneralRe: 3 level datagrid drill down Pin
Not Active12-Feb-08 0:54
mentorNot Active12-Feb-08 0:54 
GeneralRe: 3 level datagrid drill down Pin
uglyeyes12-Feb-08 12:50
uglyeyes12-Feb-08 12:50 
GeneralPrevious Page Problem Pin
waheed awan11-Feb-08 12:58
waheed awan11-Feb-08 12:58 
GeneralRe: Previous Page Problem Pin
Not Active11-Feb-08 14:46
mentorNot Active11-Feb-08 14:46 
GeneralRe: Previous Page Problem Pin
waheed awan12-Feb-08 8:14
waheed awan12-Feb-08 8:14 
GeneralRe: Previous Page Problem Pin
Not Active12-Feb-08 8:36
mentorNot Active12-Feb-08 8:36 
GeneralRe: Previous Page Problem Pin
waheed awan12-Feb-08 10:43
waheed awan12-Feb-08 10:43 
GeneralRe: Previous Page Problem Pin
Not Active12-Feb-08 11:18
mentorNot Active12-Feb-08 11:18 
GeneralRe: Previous Page Problem Pin
waheed awan12-Feb-08 11:23
waheed awan12-Feb-08 11:23 
GeneralRe: Previous Page Problem Pin
Not Active12-Feb-08 11:39
mentorNot Active12-Feb-08 11:39 
GeneralRe: Previous Page Problem Pin
waheed awan12-Feb-08 14:47
waheed awan12-Feb-08 14:47 
GeneralRe: Previous Page Problem Pin
levonh200320-May-08 7:26
levonh200320-May-08 7:26 
GeneralProblem with ListView and Request.QueryString [modified] Pin
foahchon11-Feb-08 12:54
foahchon11-Feb-08 12:54 
GeneralRe: Problem with ListView and Request.QueryString Pin
dojohansen12-Feb-08 2:23
dojohansen12-Feb-08 2:23 
QuestionInternal ASP.NET threading model Pin
dojohansen11-Feb-08 7:26
dojohansen11-Feb-08 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.