Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DatatableDatatable
Previous
 
Next
New Post
7/30/2007 8:37 AM
 

Hi everyone

I have programmatically created a GridView and would like to know if it is possible to add edit fuctionality to the gridview without having to add an sqlDatasource to it. If it is how would i go about doing that.

Here is my code

 

Dim dt As Datatable

Dim dr As DataRow

dt =

 

New DataTable'Adding Columns to GridView

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

dt.Columns.Add(

New DataColumn("Date", GetType(Integer)))New DataColumn("Hours On Duty", GetType(String)))New DataColumn("Unpaid O.T", GetType(Double)))New DataColumn("Paid O.T", GetType(Double)))New DataColumn("Admin", GetType(Double)))New DataColumn("Court", GetType(Double)))New DataColumn("INSTR", GetType(Double)))New DataColumn("STDNT", GetType(Double)))New DataColumn("COMM SERV", GetType(Double)))New DataColumn("VICT SERV", GetType(Double)))New DataColumn("Remarks", GetType(String)))

For

dr = dt.NewRow()

dr(0) = i

 

day = 1 To Date.DaysInMonth(year, month)        If IsWorkday(day, month, year) And DDList2.SelectedValue = Uniform Then

              dr(1) = 10.0

              dr(4) = 10.0

 

Else

              dr(1) =

"OFF"

              dr(4) = 0.0

 

       If DDList2.SelectedValue = Civilian Then

              dr(1) = 7.5

             dr(4) = 7.5

 

Else

 

          If DDList2.SelectedValue = CommSpec Then

                dr(1) = 10.0

               dr(4) = 10.0

 

Else

 

          If DDList2.SelectedValue = Schedule Then

                   dr(1) = 9.5

                 dr(4) = 9.5

 

              End If

 

       End If

 

   End If

 

End If

i += 1

dt.Rows.Add(dr)

 

Next

GridView1.DataSource =

GridView1.DataBind()

New DataView(dt)

month = DDList1.SelectedValue

EmpType = DDList2.SelectedValue

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DatatableDatatable


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out