|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
getting the data for dynamically for Datagridi am displaying the datagrdig (dg) headers dynamically.. now i just want to know how to display the data from a dataset to my datagrid.. for i=0 to Ds.tables(0).rows.count-1 dg.columns(i).HeaderText=ds.tables.rows(i).item(0) next now tell me if i had a dataset where i need to pass the HeaderText value to my sql query so that it will display the corresponding value to the header text... pls if any one know this help me.. it is very urgent.. thanks & regards srikanth *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! I dont really understand what you are trying to say...
First you gave the code to bind dataset to headers, then u are asking how to do that? huh?????? R. Thomas Show quoteHide quote "sri kanth" wrote: > > hi , > i am displaying the datagrdig (dg) headers dynamically.. > now i just want to know how to display the data from a dataset to my > datagrid.. > > for i=0 to Ds.tables(0).rows.count-1 > dg.columns(i).HeaderText=ds.tables.rows(i).item(0) > next > > now tell me if i had a dataset where i need to pass the > HeaderText value to my sql query so that it will display the > corresponding value to the header text... > pls if any one know this help me.. > it is very urgent.. > thanks & regards > srikanth > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! > hi,
i am giving the code to u .... Public Sub GetTemplateColumns() Dim icount, i, j, k As Integer Dim strFinishDate As String Dim str As String Dim FinishDate As DataSet Dim tc As TemplateColumn Dim HeaderText As String SBUTaskList = ObjMileStoneReport.fn_SBUTaskList(cmbSbuNames.SelectedItem.Value, Trim(cmbYear.SelectedItem.Text)) Session("SBUTaskList") = SBUTaskList For icount = 0 To SBUTaskList.Tables(0).Rows.Count - 1 HeaderText = SBUTaskList.Tables(0).Rows(icount).Item(0) tc = New TemplateColumn() strFinishDate = "" For i = 0 To DsReport.Tables(0).Rows.Count - 1 str &= DsReport.Tables(0).Rows(i).Item(0) & "-" FinishDate = ObjMileStoneReport.fn_GetBaseLineFinishDate(DsReport.Tables(0).Rows(i).I tem(0), Trim(HeaderText), Trim(cmbYear.SelectedItem.Text)) For k = 0 To FinishDate.Tables(0).Rows.Count - 1 strFinishDate = strFinishDate & Left(objDate.InvertDateMonth(FinishDate.Tables(0).Rows(k).Item(0)), 10) & "-" Next Next tc.HeaderTemplate = New DataGridTemplate(ListItemType.Header, Trim(HeaderText), str) tc.ItemTemplate = New DataGridTemplate(ListItemType.Item, HeaderText, str) dgMilestoneReport.Columns.Add(tc) Next dgMilestoneReport.DataSource = DsReport dgMilestoneReport.DataBind() Public Class DataGridTemplate Implements ITemplate Dim TemplateType As ListItemType Dim ProjectName As String Dim strproj As String() Dim kc As Integer Dim ii As String Dim ColumnName As String Dim Year As String Dim obj As New clsMilestoneReport() Sub New(ByVal type As ListItemType, ByVal ColName As String, ByVal ProjName As String) TemplateType = type ColumnName = ColName ProjectName = ProjName 'Year = Year End Sub Sub InstantiateIn(ByVal Container As Control) Implements ITemplate.InstantiateIn Dim lc1 As LiteralControl = New LiteralControl() Dim dc As DataGridItem Select Case TemplateType Case ListItemType.Header lc1.Text = ColumnName Container.Controls.Add(lc1) Case ListItemType.Item lc1.Text = ProjectName Container.Controls.Add(lc1) *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Slow down, I asked whats your question, and you are throwing code at me... I
still dont know what the question is.... R. Thomas Show quoteHide quote "sri kanth" wrote: > > hi, > i am giving the code to u .... > > Public Sub GetTemplateColumns() > Dim icount, i, j, k As Integer > Dim strFinishDate As String > Dim str As String > Dim FinishDate As DataSet > Dim tc As TemplateColumn > Dim HeaderText As String > > SBUTaskList = > ObjMileStoneReport.fn_SBUTaskList(cmbSbuNames.SelectedItem.Value, > Trim(cmbYear.SelectedItem.Text)) > Session("SBUTaskList") = SBUTaskList > For icount = 0 To SBUTaskList.Tables(0).Rows.Count - 1 > HeaderText = SBUTaskList.Tables(0).Rows(icount).Item(0) > tc = New TemplateColumn() > strFinishDate = "" > For i = 0 To DsReport.Tables(0).Rows.Count - 1 > str &= DsReport.Tables(0).Rows(i).Item(0) & "-" > FinishDate = > ObjMileStoneReport.fn_GetBaseLineFinishDate(DsReport.Tables(0).Rows(i).I > tem(0), Trim(HeaderText), Trim(cmbYear.SelectedItem.Text)) > For k = 0 To FinishDate.Tables(0).Rows.Count - 1 > strFinishDate = strFinishDate & > Left(objDate.InvertDateMonth(FinishDate.Tables(0).Rows(k).Item(0)), 10) > & "-" > Next > Next > tc.HeaderTemplate = New > DataGridTemplate(ListItemType.Header, Trim(HeaderText), str) > tc.ItemTemplate = New DataGridTemplate(ListItemType.Item, > HeaderText, str) > dgMilestoneReport.Columns.Add(tc) > Next > > dgMilestoneReport.DataSource = DsReport > dgMilestoneReport.DataBind() > > Public Class DataGridTemplate > Implements ITemplate > Dim TemplateType As ListItemType > Dim ProjectName As String > Dim strproj As String() > Dim kc As Integer > Dim ii As String > Dim ColumnName As String > Dim Year As String > Dim obj As New clsMilestoneReport() > > Sub New(ByVal type As ListItemType, ByVal ColName As String, > ByVal ProjName As String) > TemplateType = type > ColumnName = ColName > ProjectName = ProjName > 'Year = Year > End Sub > Sub InstantiateIn(ByVal Container As Control) Implements > ITemplate.InstantiateIn > Dim lc1 As LiteralControl = New LiteralControl() > Dim dc As DataGridItem > > Select Case TemplateType > Case ListItemType.Header > lc1.Text = ColumnName > Container.Controls.Add(lc1) > Case ListItemType.Item > lc1.Text = ProjectName > Container.Controls.Add(lc1) > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! >
Adding "delete" functionality in DataGrid - without a ButtonColumn
Add additional row into header? bound columns of a datagrid How To Insert ASP.NET User Control into DataGrid Column? DataGrid with Dropdown list Need to Format a zipcode into xxxxx-xxxx. Why doesn't the CssClass property change the visual display of my datagrid cells? Datagrid colum has no Dataformat property Add header text dynamically in a datagrid with templatecolumns? Printer-Friendly DataGrid option |
|||||||||||||||||||||||