Link to home
Start Free TrialLog in
Avatar of Moiz Saifuddin
Moiz Saifuddin

asked on

Input Data in an empty Column of a datagrid

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()
Avatar of nparthi
nparthi

ASKER CERTIFIED SOLUTION
Avatar of ramesh12
ramesh12

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Moiz Saifuddin

ASKER

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



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
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

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