conditional id datagrid column

Discussion in 'ASP .Net Datagrid Control' started by DC Gringo, Feb 18, 2004.

  1. DC Gringo

    DC Gringo Guest

    I have a simple datagrid, created by the VS.NET designer and need to output
    the value of "0" (zero) if the value is null in the clnPopulationCensus
    column.

    Here's my front end code:

    <asp:BoundColumn DataField="clnPopulationCensus"
    SortExpression="clnPopulationCensus" HeaderText="Population (Census)"
    DataFormatString=""></asp:BoundColumn>

    Would this go in the DataFormatString column? Or somewhere else?




    Here's my adapter:

    'SqlDataAdapter1
    '
    Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
    Me.SqlDataAdapter1.TableMappings.AddRange(New
    System.Data.Common.DataTableMapping() {New
    System.Data.Common.DataTableMapping("Table", "sac1SelectSurvey1", New
    System.Data.Common.DataColumnMapping() {New
    System.Data.Common.DataColumnMapping("clnGUID", "clnGUID"), New
    System.Data.Common.DataColumnMapping("clnPriorityCorrectedTC",
    "clnPriorityCorrectedTC"), New
    System.Data.Common.DataColumnMapping("clnMADoneTC", "clnMADoneTC"), New
    System.Data.Common.DataColumnMapping("clnMASchoolTC", "clnMASchoolTC"), New
    System.Data.Common.DataColumnMapping("clnMAPosterTC", "clnMAPosterTC"), New
    System.Data.Common.DataColumnMapping("clnMARadioTC", "clnMARadioTC"), New
    System.Data.Common.DataColumnMapping("clnMAPerformingGroupTC",
    "clnMAPerformingGroupTC"), New
    System.Data.Common.DataColumnMapping("clnMACommunityCenterTC",
    "clnMACommunityCenterTC"), New
    System.Data.Common.DataColumnMapping("clnMAReligiousOrganizationTC",
    "clnMAReligiousOrganizationTC"), New
    System.Data.Common.DataColumnMapping("clnMAOtherTC", "clnMAOtherTC"), New
    System.Data.Common.DataColumnMapping("clnMAOther", "clnMAOther"), New
    System.Data.Common.DataColumnMapping("clnMAOrganisation",
    "clnMAOrganisation")}), New System.Data.Common.DataTableMapping("Table1",
    "Table1", New System.Data.Common.DataColumnMapping() {New
    System.Data.Common.DataColumnMapping("clnGUID", "clnGUID"), New
    System.Data.Common.DataColumnMapping("clnName", "clnName")})})


    _____
    DC G
     
    DC Gringo, Feb 18, 2004
    #1
    1. Advertising

  2. Your post went unanswered. Have you resolved this issue?

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "DC Gringo" <> wrote in message
    news:u6$...
    > I have a simple datagrid, created by the VS.NET designer and need to

    output
    > the value of "0" (zero) if the value is null in the clnPopulationCensus
    > column.
    >
    > Here's my front end code:
    >
    > <asp:BoundColumn DataField="clnPopulationCensus"
    > SortExpression="clnPopulationCensus" HeaderText="Population (Census)"
    > DataFormatString=""></asp:BoundColumn>
    >
    > Would this go in the DataFormatString column? Or somewhere else?
    >
    >
    >
    >
    > Here's my adapter:
    >
    > 'SqlDataAdapter1
    > '
    > Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
    > Me.SqlDataAdapter1.TableMappings.AddRange(New
    > System.Data.Common.DataTableMapping() {New
    > System.Data.Common.DataTableMapping("Table", "sac1SelectSurvey1", New
    > System.Data.Common.DataColumnMapping() {New
    > System.Data.Common.DataColumnMapping("clnGUID", "clnGUID"), New
    > System.Data.Common.DataColumnMapping("clnPriorityCorrectedTC",
    > "clnPriorityCorrectedTC"), New
    > System.Data.Common.DataColumnMapping("clnMADoneTC", "clnMADoneTC"), New
    > System.Data.Common.DataColumnMapping("clnMASchoolTC", "clnMASchoolTC"),

    New
    > System.Data.Common.DataColumnMapping("clnMAPosterTC", "clnMAPosterTC"),

    New
    > System.Data.Common.DataColumnMapping("clnMARadioTC", "clnMARadioTC"), New
    > System.Data.Common.DataColumnMapping("clnMAPerformingGroupTC",
    > "clnMAPerformingGroupTC"), New
    > System.Data.Common.DataColumnMapping("clnMACommunityCenterTC",
    > "clnMACommunityCenterTC"), New
    > System.Data.Common.DataColumnMapping("clnMAReligiousOrganizationTC",
    > "clnMAReligiousOrganizationTC"), New
    > System.Data.Common.DataColumnMapping("clnMAOtherTC", "clnMAOtherTC"), New
    > System.Data.Common.DataColumnMapping("clnMAOther", "clnMAOther"), New
    > System.Data.Common.DataColumnMapping("clnMAOrganisation",
    > "clnMAOrganisation")}), New System.Data.Common.DataTableMapping("Table1",
    > "Table1", New System.Data.Common.DataColumnMapping() {New
    > System.Data.Common.DataColumnMapping("clnGUID", "clnGUID"), New
    > System.Data.Common.DataColumnMapping("clnName", "clnName")})})
    >
    >
    > _____
    > DC G
    >
    >
     
    Alvin Bruney [MVP], Mar 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Hammond
    Replies:
    1
    Views:
    3,689
    bruce barker
    Nov 26, 2003
  2. Hai Nguyen
    Replies:
    0
    Views:
    416
    Hai Nguyen
    Jan 16, 2004
  3. Dexter
    Replies:
    1
    Views:
    440
    Eliyahu Goldin
    Jan 18, 2005
  4. John E.
    Replies:
    3
    Views:
    4,510
    masoud bayan
    Mar 25, 2005
  5. Alec S.
    Replies:
    10
    Views:
    10,332
    Alec S.
    Apr 16, 2005
Loading...

Share This Page