Solved

Input Data in an empty Column of a datagrid

Posted on 2004-04-22
7
236 Views
Last Modified: 2010-04-24
Below is my code which populates a datagrid and I create a column in runtime as you can see , ColumnName: Patient, I set array values which are fetched from the datareader as dr.getvalue(0), how do I place a value in the new Column I created and in the first row.


 Ssql = "select TO_CHAR(APPTDATE,'MM/DD/YYYY') AS APPTDATE, TO_CHAR(APPTTIME,'HH:MM AM') AS APTTIME from scratchsuggest WHERE APPTDATE <= TO_DATE('04/23/2004','MM/DD/YYYY') GROUP BY TO_CHAR(APPTDATE,'MM/DD/YYYY'), TO_CHAR(APPTTIME,'HH:MM AM') ORDER BY APPTDATE, TO_DATE(APTTIME, 'HH:MI AM')"
        With cmd
            .CommandText = Ssql
            .Connection = Cn
        End With
        myAdaptor.SelectCommand = cmd
        myAdaptor.Fill(DataSet1)
        DataSet1.Tables(0).Columns.Add("Patient")
        DataGrid1.DataSource = DataSet1
        DataGrid1.DataBind()
        dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) 'DataReader
        Dim sDemo(0) as string        
        While dr.Read
            dr.GetValue(0)
            sDemo(nCtr) = dr.GetValue(0)
            nCtr = nCtr + 1
            ReDim Preserve sDemo(nCtr)
        End While
        ReDim Preserve sDemo(nCtr - 1)
        Cn.Close()
0
Comment
Question by:Moizsaif123
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:nparthi
ID: 10891118
0
 
LVL 7

Accepted Solution

by:
ramesh12 earned 500 total points
ID: 10891538
Can you not add the text to the dataset something like this

dataset1.Tables(0).Rows(0).Item("patient") = yourvalue

and then use databind
0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 10891644
ramesh12, Iv been trying so hard to do this, dint know it would be so simple, ill be taking more of yur help later



0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 4

Author Comment

by:Moizsaif123
ID: 10893742
I am receiving data using  dr.GetValue(0) and storing the data in the colums created, how do i convert these textfields into linkbuttons on runtime...

willing to give extra points





Moiz
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10894088
0
 
LVL 1

Expert Comment

by:nparthi
ID: 10896317
Why not add a hyperlink column instead of a link button. Take a look at this.

http://authors.aspalliance.com/aspxtreme/webforms/controls/addinghyperlinkcolumnstodatagrid.aspx

0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 10898636
I am looking at adding columns in a runtime perspective, nothings going to be done on design time...
I want to add a link button column not a hyperlink column because the click event of that link should hit the click event of that button, so how do i add a link button column instead of a regular column in runtime.



Moiz
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now