Solved

Input Data in an empty Column of a datagrid

Posted on 2004-04-22
7
276 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…

680 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