Link to home
Start Free TrialLog in
Avatar of coleenholley
coleenholleyFlag for United States of America

asked on

Adding a DropDownlist to a repeater Control using an ObjectDataSource

Hi all :-)
I've stopped tying to use a GridView Control to create a data entry form and am now using a repeater control.  I've got an ASP.Net table in a Repeater control, and this generates the blank rows for Data entry wonderfully.  However, I need to populate 3 DDL's inside the Repeater and when I try to connect the DDL to the ODS like I did with the Gridview DDL's, I get an error: "DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'MODE_TY'."

Attached is both my SP.Net code and my VB.Net code.  thanks for any help - I appreciate it
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RepeaterTest.aspx.vb" Inherits="DataListRepeaterBasics_RepeaterTest" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
	<link href="../Includes/fuelfont.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
	 <h2>Test Receipts Data Entry</h2>
	<asp:Repeater ID="Repeater1" runat="server" EnableViewState="false"> <%--DataSourceID="DMVODSRcptDisb"--%>
		<HeaderTemplate>
			<asp:Table ID=tblRptrheader runat=server>
				<asp:TableHeaderRow HorizontalAlign =center>
				<asp:TableHeaderCell><asp:Label ID="lblCarrFEIN" runat="server" Text="Carrier FEIN" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblCarrName" runat="server" Text="Carrier Name" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblModeTy" runat="server" Text="Mode Type" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblOrigCity" runat="server" Text="Origin City" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblOrigState" runat="server" Text="Origin State" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDestCity" runat="server" Text="Dest City" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDestState" runat="server" Text="Dest State" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblSellerFEIN" runat="server" Text="Seller's FEIN" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblRcvdFrom" runat="server" Text="Received From" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDateRcvd" runat="server" Text="Date Received" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblBOL" runat="server" Text="BOL/Manifest" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblNetGal" runat="server" Text="Net Gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblGrossGal" runat="server" Text="Gross gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblBillGal" runat="server" Text="Billed Gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				</asp:TableHeaderRow>
			</asp:Table>
		</HeaderTemplate>
		<ItemTemplate>
			<asp:Table ID=tblRptrtable runat=server>
				<asp:TableRow>
				     <asp:TableCell><asp:TextBox ID="txtCarrFEIN" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				     <asp:TableCell><asp:TextBox ID="txtCarrName" runat="server" Width=80px></asp:TextBox></asp:TableCell>
  				     <asp:TableCell>
					<asp:DropDownList ID="ddlModeType" runat="server" Width=80px DataSourceID="odsuf_rtdata_mfmo" DataTextField="data_txt" 
		DataValueField="key_txt" SelectedValue='<%# Eval("MODE_TY") %>' >
					</asp:DropDownList>
				     </asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtOrigCity" runat="server" Width=80px></asp:TextBox></asp:TableCell>
			         <asp:TableCell>
				     <asp:DropDownList ID="ddlOrigState" runat="server" Width=80px>
    				     </asp:DropDownList>
				</asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtDestCity" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:DropDownList ID="ddlDestState" runat="server" Width=80px>
					</asp:DropDownList>
				</asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtSellerFEIN" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtRcvdFrom" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtDateRcvd" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtBOL" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtNetGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtGrossGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtBillGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				</asp:TableRow>
			</asp:Table>
		</ItemTemplate>
	</asp:Repeater>
	<br />
	<asp:ObjectDataSource ID="DMVODSRcptDisb" runat="server" SelectMethod="populate_datagrid" TypeName="misc_func">
	    <SelectParameters>
		    <asp:SessionParameter Name="ls_mc_rqd_fld" SessionField="ls_mc_rqd_fld" Type="String" />
		    <asp:SessionParameter Name="bus_id" SessionField="bus_id" Type="String" />
		    <asp:SessionParameter Name="ls_fuelty" SessionField="ls_fuelty" Type="String" />
		    <asp:SessionParameter Name="ls_fuelcd" SessionField="ls_fuelcd" Type="String" />
		    <asp:SessionParameter Name="ls_sch" SessionField="ls_sch" Type="String" />
		    <asp:SessionParameter Name="lsRcptDisbTy" SessionField="lsRcptDisbTy" Type="String" />
		    <asp:SessionParameter Name="ls_rcv_sold_dt" SessionField="ls_rcv_sold_dt" Type="String" />
		    <asp:SessionParameter Name="emp_id" SessionField="emp_id" Type="String" />
		    <asp:SessionParameter Name="fein" SessionField="fein" Type="String" />
		    <asp:SessionParameter Name="rptprdnum" SessionField="rptprdnum" Type="String" />
	    </SelectParameters>
	</asp:ObjectDataSource>
	<br />	
	<asp:ObjectDataSource ID="odsuf_rtdata_mfmo" runat="server" SelectMethod="uf_rtdata_rftID" TypeName="misc_func">
	    <SelectParameters>
		<asp:Parameter ConvertEmptyStringToNull="False" DefaultValue="MFMO" Name="as_ref_tbl_id" Type="String" />
		</SelectParameters>
	</asp:ObjectDataSource>
	<br />
	    <asp:ObjectDataSource ID="odsuf_rtdata_gsta" runat="server" SelectMethod="uf_rtdata"
		    TypeName="misc_func">
		    <SelectParameters>
			    <asp:Parameter DefaultValue="GSTA" Name="as_ref_tbl_id" Type="String" />
		    </SelectParameters>
	    </asp:ObjectDataSource>
    </div>
    </form>
</body>
</html>
 
 
Partial Class DataListRepeaterBasics_RepeaterTest
Inherits System.Web.UI.Page
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	
	Dim dtBlankRows as New DataTable
	Dim drBlankRows as DataRow
	Dim i as Integer = 0
	
	dtBlankRows.Columns.Add(New DataColumn("Carrier FEIN", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Carrier Name", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Mode Type", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Orig City", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Orig State", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Dest City", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Dest State", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Seller's FEIN", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Received From", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Date Received", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("BOL/Manifest", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Net Gallons", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Gross Gallons", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Billed Gallons", GetType(String)))
	
	For i = 0 to 9
	drBlankRows = dtBlankRows.NewRow()
    dtBlankRows.Rows.Add(drBlankRows)
	Next
	
	Try
		 Repeater1.DataSource = dtBlankRows
		 Repeater1.DataBind()
    Catch
            fatal_error_handle()
    End Try
End Sub

Open in new window

Avatar of CmdoProg2
CmdoProg2
Flag of United States of America image

The dtBlankRows table does not have a "MODE_TY" column to add.  Are you trying to set the select value to "MODE_TY" or the value in the MODE_TY column?
Avatar of coleenholley

ASKER

Trying to set the value to "MODE_TY" which is (should be) obtained from binding to the ODS odsuf_rtdata_mfmo - the ODS calls a RPC to get the values from a Table where we store all data used for all dropdowns in all our applications.  So I guess the issue is that when I try to bind the column of the ASP:Table to the ODS - it gives the error I showed above.  What I don't understand is that the ASP.Net code that I use to bind that DDL to the ODS is exactly the same as the code in another app that binds a column in a GridView to the same values for a DDL.  Is the Bind for a column in a Repeater different than the bind for a column in a GridView?
You need to change the name of the column and set the default in your blank data row...
					<asp:DropDownList ID="ddlModeType" runat="server" Width=80px DataSourceID="odsuf_rtdata_mfmo" DataTextField="data_txt" 
		DataValueField="key_txt" SelectedValue='<%# Eval("Mode Type") %>' >
					</asp:DropDownList>
 
.....
 
    For i = 0 To 9
      drBlankRows = dtBlankRows.NewRow()
      drBlankRows("Mode Type") = "MODE_TY"
      dtBlankRows.Rows.Add(drBlankRows)
    Next

Open in new window

An Alternate way to set the default value on a bound would be through the data bound event.  However, this would only work on the first row of the repeater, but I include the snippet  FYI


  Protected Sub ddlModeType_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlModeType.DataBound
    Try
      CType(sender, DropDownList).SelectedValue = "MODE_TY"
    Catch ex As Exception
 
    End Try
  End Sub

Open in new window

Thanks - I am trying your suggestions now and will let you know how it works :-)
Okay - this is the error I get on the VB.Net code "'ddlModeType' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value."

And this is the error I get on the ASP.Net Code: "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

Oh (Bangs head!!) I just had a "Duh" moment...the ObjectDatasource odsuf_rtdata_mfmo as I mentioned is calling a two values via a function - which are the key_txt field and the data_txt field from the table where we store all the values for the applications DDL's (did I mention that I really HATE the way we call our data - through an RPC call to a Cobol program?) Any way, the MODE_TY value would be a value coming from the COBOL program - but at this point the Cobol program doesn't get called yet.  It get's called after the data is entered into the data entry form (which is what I'm trying to create using a repater control.)  The values that should be called to fill the DDL are the key_txt and data_txt fields.  Key_txt is the key and data_txt is the value that should actually display in the DDL.

So I just realized that using drBlankRows("Mode Type") = "MODE_TY" won't work (this is the "duh" moment on my part) - it needs to tie to the key_txt and display the data_txt.  Here's a a little snippet of what I'm trying to do - maybe we can combine the two bits of code (yours & mine below) to come up with the answer...thanks for your help! :-)

This is what I'm currently trying in the VB code behind:
 
Dim dtRtdataModeTy as New DataTable
Dim drRtdataModeTy as DataRow
 
dtRtdataModeTy = io_misc_func.uf_rtdata("MFMO")
drRtdataModeTy = dtRtdataModeTy.NewRow()
drRtdataModeTy(0) = ""
drRtdataModeTy(1) = ""
dtRtdataModeTy.Rows.InsertAt(drRtdataModeTy, 0)
 
ddlModeType.DataSource = dtRtdataModeTy
ddlModeType.DataTextField = "data_txt"
ddlModeType.DataValueField = "key_txt"
ddlModeType.DataBind()

Open in new window

I used the snippet below to test the repeater.   After looking at your snippet, I added a blank record and removed the statement
      drBlankRows("Mode Type") = "MODE_TY"

It selected the 4th item. So I suggest you remove the above line in your code.


  Public Function FetchTypes() As DataTable
    Dim dt As New DataTable
    dt.Columns.Add(New DataColumn("key_txt", GetType(String)))
    dt.Columns.Add(New DataColumn("data_txt", GetType(String)))
    Dim dr As DataRow
    For x As Integer = 0 To 2
      dr = dt.NewRow
      dr("key_txt") = String.Format("MODE_{0}", x)
      dr("data_txt") = String.Format("Mode Type{0}", x)
      dt.Rows.Add(dr)
    Next
    dr = dt.NewRow
    dr("key_txt") = ""
    dr("data_txt") = ""
    dt.Rows.Add(dr)   dr = dt.NewRow
    dr("key_txt") = "MODE_TY"
    dr("data_txt") = "Select Mode"
    dt.Rows.Add(dr)
    Return dt
  End Function

Open in new window

Well, maybe I missunderstood how to implement your code.  I'll post below how I used it - the thing is that I called the function that is supposed to go and get the values from the rtData table (key_txt and data_txt) which is io_misc_func.uf_rtdata("MFMO").  I tried putting in the blank rows as you did in the Fetch function, but that throws an exception that the row already exists so here is what I did:

This doesn't throw any errors, and it does populate the repeater with blank rows, but it doesn't populate the Mode Type Drop down either...any other suggestions?
Dim io_misc_func As New misc_func
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
	Try
		io_misc_func = New misc_func
	Catch ex As Exception
		io_misc_func  = Nothing
	End Try
	
	Dim dtBlankRows as New DataTable
	Dim drBlankRows as DataRow
	Dim i as Integer = 0
	
	dtBlankRows.Columns.Add(New DataColumn("Carrier FEIN", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Carrier Name", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Mode Type", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Orig City", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Orig State", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Dest City", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Dest State", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Seller's FEIN", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Received From", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Date Received", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("BOL/Manifest", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Net Gallons", GetType(String)))
	dtBlankRows.Columns.Add(New DataColumn("Gross Gallons", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Billed Gallons", GetType(String)))
 
    For i = 0 to 9
      drBlankRows = dtBlankRows.NewRow()
      dtBlankRows.Rows.Add(drBlankRows)
    Next
 
    Try
	 Repeater1.DataSource = FetchTypes 'dtBlankRows
	 Repeater1.DataBind()
    Catch
            fatal_error_handle()
    End Try
End Sub
	
Public Function FetchTypes() As DataTable
	Dim dtRtdata As New DataTable
	Dim drRtdata As DataRow
	Dim x as Integer = 0
	dtRtdata.Columns.Add(New DataColumn("key_txt", GetType(String)))
	dtRtdata.Columns.Add(New DataColumn("data_txt", GetType(String)))
	For x = 0 To 2
		drRtdata = dtRtdata.NewRow
		drRtdata("key_txt") = io_misc_func.uf_rtdata("MFMO")
		drRtdata("data_txt") = io_misc_func.uf_rtdata("MFMO")
		dtRtdata.Rows.Add(drRtdata)
	Next
	Return dtRtdata
		
End Function

Open in new window

I stepped through this line by line to make sure that the misc_func was getting the values from the rtData table - and it is; that part is working correctly.  I tried adding this bit of code to my function:

dtRtdataModeTy= io_misc_func.uf_rtdata("MFMO")
drRtdataModeTy = dtRtdataModeTy.NewRow()
drRtdataModeTy(0) = ""
drRtdataModeTy(1) = ""
dtRtdataModeTy.Rows.InsertAt(drRtdataModeTy, 0)
            
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataSource = dtRtdataModeTy
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataSource = "data_txt"
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataSource = "key_txt"
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataBind

Unfortunately I get the dreaded "Object reference not set to an instance of an object." at this line of code: ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataSource = dtRtdataModeTy so I am assuming I can't use the FindControl in a Repeater?  (I hate the word Assume...) but I don't know what/how else to bind just that column to the rtdata table...
Oops - when I copied & Pasted I copied DataSource 3 times!  The code above should have been:

ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataSource = dtRtdataModeTy
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataTextField = "data_txt"
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataValueField = "key_txt"
ctype(repeater1.FindControl("ddlModeType"), DropDownList).DataBind

But it error out on the first line anyway...
Sorry for the confusion, but the fetchtype function is a separate class.  

  The error on the ctype statement is caused by the dropdownlist is a found on a row control of the repeater and not a directly under the repeater code.

I have combined our code below:  
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
	<link href="../Includes/fuelfont.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
	 <h2>Test Receipts Data Entry</h2>
	<asp:Repeater ID="Repeater1" runat="server" EnableViewState="false"> <%--DataSourceID="DMVODSRcptDisb"--%>
		<HeaderTemplate>
			<asp:Table ID=tblRptrheader runat=server>
				<asp:TableHeaderRow HorizontalAlign =center>
				<asp:TableHeaderCell><asp:Label ID="lblCarrFEIN" runat="server" Text="Carrier FEIN" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblCarrName" runat="server" Text="Carrier Name" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblModeTy" runat="server" Text="Mode Type" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblOrigCity" runat="server" Text="Origin City" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblOrigState" runat="server" Text="Origin State" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDestCity" runat="server" Text="Dest City" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDestState" runat="server" Text="Dest State" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblSellerFEIN" runat="server" Text="Seller's FEIN" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblRcvdFrom" runat="server" Text="Received From" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblDateRcvd" runat="server" Text="Date Received" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblBOL" runat="server" Text="BOL/Manifest" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblNetGal" runat="server" Text="Net Gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblGrossGal" runat="server" Text="Gross gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				<asp:TableHeaderCell><asp:Label ID="lblBillGal" runat="server" Text="Billed Gallons" Width=80px></asp:Label></asp:TableHeaderCell>
				</asp:TableHeaderRow>
			</asp:Table>
		</HeaderTemplate>
		<ItemTemplate>
			<asp:Table ID=tblRptrtable runat=server>
				<asp:TableRow>
				     <asp:TableCell><asp:TextBox ID="txtCarrFEIN" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				     <asp:TableCell><asp:TextBox ID="txtCarrName" runat="server" Width=80px></asp:TextBox></asp:TableCell>
  				     <asp:TableCell>
					<asp:DropDownList ID="ddlModeType" runat="server" Width=80px DataSourceID="odsuf_rtdata_mfmo" DataTextField="data_txt" 
		DataValueField="key_txt" SelectedValue='<%# Eval("Mode Type") %>' >
					</asp:DropDownList>
				     </asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtOrigCity" runat="server" Width=80px></asp:TextBox></asp:TableCell>
			         <asp:TableCell>
				     <asp:DropDownList ID="ddlOrigState" runat="server" Width=80px>
    				     </asp:DropDownList>
				</asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtDestCity" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:DropDownList ID="ddlDestState" runat="server" Width=80px>
					</asp:DropDownList>
				</asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtSellerFEIN" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtRcvdFrom" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtDateRcvd" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtBOL" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtNetGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtGrossGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				<asp:TableCell><asp:TextBox ID="txtBillGal" runat="server" Width=80px></asp:TextBox></asp:TableCell>
				</asp:TableRow>
			</asp:Table>
		</ItemTemplate>
	</asp:Repeater>
	<br />
	<asp:ObjectDataSource ID="DMVODSRcptDisb" runat="server" SelectMethod="populate_datagrid" TypeName="misc_func">
	    <SelectParameters>
		    <asp:SessionParameter Name="ls_mc_rqd_fld" SessionField="ls_mc_rqd_fld" Type="String" />
		    <asp:SessionParameter Name="bus_id" SessionField="bus_id" Type="String" />
		    <asp:SessionParameter Name="ls_fuelty" SessionField="ls_fuelty" Type="String" />
		    <asp:SessionParameter Name="ls_fuelcd" SessionField="ls_fuelcd" Type="String" />
		    <asp:SessionParameter Name="ls_sch" SessionField="ls_sch" Type="String" />
		    <asp:SessionParameter Name="lsRcptDisbTy" SessionField="lsRcptDisbTy" Type="String" />
		    <asp:SessionParameter Name="ls_rcv_sold_dt" SessionField="ls_rcv_sold_dt" Type="String" />
		    <asp:SessionParameter Name="emp_id" SessionField="emp_id" Type="String" />
		    <asp:SessionParameter Name="fein" SessionField="fein" Type="String" />
		    <asp:SessionParameter Name="rptprdnum" SessionField="rptprdnum" Type="String" />
	    </SelectParameters>
	</asp:ObjectDataSource>
	<br />	
					</asp:DropDownList><asp:ObjectDataSource ID="odsuf_rtdata_mfmo" runat="server" SelectMethod="FetchTypes"
              TypeName="Class1"></asp:ObjectDataSource>
	<br />
	    <asp:ObjectDataSource ID="odsuf_rtdata_gsta" runat="server" SelectMethod="uf_rtdata"
		    TypeName="misc_func">
		    <SelectParameters>
			    <asp:Parameter DefaultValue="GSTA" Name="as_ref_tbl_id" Type="String" />
		    </SelectParameters>
	    </asp:ObjectDataSource>
    </div>
    </form>
</body>
</html>
 
.....................
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    Dim dtBlankRows As New DataTable
    Dim drBlankRows As DataRow
    Dim i As Integer = 0
 
    dtBlankRows.Columns.Add(New DataColumn("Carrier FEIN", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Carrier Name", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Mode Type", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Orig City", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Orig State", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Dest City", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Dest State", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Seller's FEIN", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Received From", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Date Received", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("BOL/Manifest", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Net Gallons", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Gross Gallons", GetType(String)))
    dtBlankRows.Columns.Add(New DataColumn("Billed Gallons", GetType(String)))
 
    For i = 0 To 9
      drBlankRows = dtBlankRows.NewRow()
      dtBlankRows.Rows.Add(drBlankRows)
    Next
 
    Try
      Repeater1.DataSource = dtBlankRows
      Repeater1.DataBind()
    Catch
      fatal_error_handle()
    End Try
  End Sub
 
... 
Public Class Class1
 
  Public Function FetchTypes() As DataTable
 
    Dim dtRtdataModeTy As New DataTable
    Dim drRtdataModeTy As DataRow
 
    dtRtdataModeTy = io_misc_func.uf_rtdata("MFMO")
    drRtdataModeTy = dtRtdataModeTy.NewRow()
    drRtdataModeTy(0) = ""
    drRtdataModeTy(1) = ""
    dtRtdataModeTy.Rows.InsertAt(drRtdataModeTy, 0)
 
    Return dtRtdataModeTy
  End Function
End Class

Open in new window

Thanks - okay I have a dumb question though... can I use FetchTypes as a public function instead of a class?  My company has a class "misc_func" which contains MANY public functions that we re-use from many different programs.  And - if so, where do I call it?  Do I use it as the DataSource on the DataBind like so?:

Repeater1.DataSource = FetchTypes
Repeater1.DataBind

Thanks again for your help.

Coleen
ASKER CERTIFIED SOLUTION
Avatar of CmdoProg2
CmdoProg2
Flag of United States of America image

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
Well, that didn't work!  I can definitely see that the function/class is getting the values, but the DDL is not getting populated.  Here is a screen shot of what I am getting: (Note, the headers are not aligned with the columns yet, that is easy to fix - after I get the DDL to work!) Thanks!
repeaterpic.jpg
Okay - now that I got the databind binding to the correct ODS - this works!  I can't thank you enough!  You are my hero!  Thanks!!!

Coleen
Once I understood where to do the databind this worked like a charm.  Thank you!
Welcome