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/YY YY') AS APPTDATE, TO_CHAR(APPTTIME,'HH:MM AM') AS APTTIME from scratchsuggest WHERE APPTDATE <= TO_DATE('04/23/2004','MM/D D/YYYY') GROUP BY TO_CHAR(APPTDATE,'MM/DD/YY YY'), 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("Pati ent")
DataGrid1.DataSource = DataSet1
DataGrid1.DataBind()
dr = cmd.ExecuteReader(CommandB ehavior.Cl oseConnect ion) '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()
Ssql = "select TO_CHAR(APPTDATE,'MM/DD/YY
With cmd
.CommandText = Ssql
.Connection = Cn
End With
myAdaptor.SelectCommand = cmd
myAdaptor.Fill(DataSet1)
DataSet1.Tables(0).Columns
DataGrid1.DataSource = DataSet1
DataGrid1.DataBind()
dr = cmd.ExecuteReader(CommandB
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()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
ASKER
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
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
http://authors.aspalliance.com/aspxtreme/webforms/controls/addinghyperlinkcolumnstodatagrid.aspx
ASKER
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
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
http://www.dotnetjohn.com/articles.aspx?articleid=18