Solved

Input Data in an empty Column of a datagrid

Posted on 2004-04-22
7
259 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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