| | |
Datagrid inside repeater-simple reference problem
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 7
Reputation:
Solved Threads: 0
Guys, i have been struggling with this for past three days...
here is what i have...
aspx page
codebehind
everything works fine...but i want to add subheader and break messages to the child datagrids that are created for the each repeater item...i am not sure how to reference them...here is what i am trying to add...the below is the code i have for a datagrid without repeater and works fine...but now i want to do the same thing for each datagrid inside repeater...
can some please assist me with this...
here is what i have...
aspx page
ASP.NET Syntax (Toggle Plain Text)
<form id="Form1" method="post" runat="server"> <asp:repeater id="titleRepeater" runat="server" EnableViewState="False"> <ItemTemplate> <b><%# DataBinder.Eval(Container.DataItem,"Item_No") %> <br> </b> <asp:DataGrid ID="maingrid" Runat="server" AutoGenerateColumns=True DataSource='<%# GetDataSource( Container.DataItem )%>' OnItemDataBound="maingrid_showformatting" ShowFooter=True > </asp:DataGrid> <br> </ItemTemplate> </asp:repeater></form>
codebehind
ASP.NET Syntax (Toggle Plain Text)
Private MyDataset As New DataSet Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then BindGrid() End If End Sub Private Sub BindGrid() Dim strConnection As String strConnection = "conn string here" Dim objConnection As OleDbConnection objConnection = New OleDbConnection(strConnection) objConnection.Open() Dim StrSQL As String = "sql 1 here" Dim strSQL1 As String = "sql 2 here" Dim objDa As OleDbDataAdapter Dim objDa1 As OleDbDataAdapter objDa = New OleDbDataAdapter(StrSQL, objConnection) objDa1 = New OleDbDataAdapter(strSQL1, objConnection) objDa.Fill(MyDataset, "Parent") objDa1.Fill(MyDataset, "Child") titleRepeater.DataSource = MyDataset.Tables("Parent") titleRepeater.DataBind() End Sub Public Function GetDataSource(ByVal dataItem As Object) As DataView Dim intNo As String = DataBinder.Eval(dataItem, "Item_No") Dim dv As DataView = MyDataset.Tables("Child").DefaultView dv.RowFilter = "Item_No='" & intNo & "'" Return dv End Function Sub maingrid_showformatting(ByVal sender As Object, ByVal e As DataGridItemEventArgs) 'some formatting here end sub
everything works fine...but i want to add subheader and break messages to the child datagrids that are created for the each repeater item...i am not sure how to reference them...here is what i am trying to add...the below is the code i have for a datagrid without repeater and works fine...but now i want to do the same thing for each datagrid inside repeater...
ASP.NET Syntax (Toggle Plain Text)
Dim row As TableRow Dim i As Integer = 0 Do While i <= ds.Tables(0).Rows.Count - 2 If ds.Tables(0).Rows(i).Item("calcLength") Is DBNull.Value Then Dim shRow As DataRow = ds.Tables(0).NewRow shRow("Station") = "Subheading" ds.Tables(0).Rows.InsertAt(shRow, i + 1) i = i + 1 Else Dim eRow As DataRow = ds.Tables(0).NewRow eRow("calclength") = ds.Tables(0).Rows(i).Item("calcLength") eRow("calcAve_Width") = ds.Tables(0).Rows(i).Item("calcAve_Width") eRow("calcSF") = ds.Tables(0).Rows(i).Item("calcSF") ds.Tables(0).Rows.InsertAt(eRow, i + 1) i = i + 1 End If i = i + 1 Loop 'End inserting break message mydg.DataSource = ds mydg.DataBind()
can some please assist me with this...
![]() |
Similar Threads
- Problem passing variables to thread (Perl)
- Simple include() problem (PHP)
- Datagrid to draw a table (C#)
- Nest Datagrids (ASP.NET)
- Printing the datagrid control (ASP.NET)
- Annoying problem with moving files (Windows NT / 2000 / XP)
- Internet graphics display problem (OS X)
Other Threads in the ASP.NET Forum
- Previous Thread: how to add rows to the child grid
- Next Thread: Server Error in '/CM_site' Application.
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos appliances asp asp.net bc30451 beginner bottomasp.net box browser button c# c#gridviewcolumn cac checkbox click commonfunctions compatible confirmationcodegeneration content courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dialog dropdownlist dynamically edit fileuploader fill flash formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery listbox microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





