Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Input Data in an empty Column of a datagrid

Posted on 2004-04-22
7
Medium Priority
?
305 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 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Screencast - Getting to Know the Pipeline
Suggested Courses

886 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