Sideway
output.to from Sideway
Draft for Information Only

Content

How To: Find TypeName Property of ObjectDatasource
 Find TypeName Property of ObjectDatasource
  Examples
   Examples of ASP.NET C# page
   Examples of ASP.NET VB page
 Sources and References

How To: Find TypeName Property of ObjectDatasource

Find TypeName Property of ObjectDatasource

The typeName property of ObjectDatasource can be obtained by initializing TypeName property of the ObjectDatasource during Page_Init event.
public void Page_Init(object o, EventArgs e)
    {
        ObjectDataSourceProducts.TypeName = this.GetType().AssemblyQualifiedName;
    }
Or
public Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
    ObjectDataSourceProducts.TypeName = sender.GetType().AssemblyQualifiedName
End Sub

Examples

The following code example shows how to find typename property of ObjectDatasource.

Examples of ASP.NET C# page

Examples of ASP.NET C# page
ASP.NET Code Input:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head id="Head1" runat="server">
        <title>Sample Page</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <%@ Page Language="C#" %>
        <script runat="server">
            public void Page_Init(object o, EventArgs e)
            {
                ObjectDataSourceProducts.TypeName = this.GetType().AssemblyQualifiedName;
            }
            public static List<Product> GetProducts()
            {
                List<Product> results = new List<Product>()
                {
                    new Product(){ ProductID=1, ProductName="Product One" },
                    new Product(){ ProductID=2, ProductName="Product Two" }
                };
                return results;
            }
            public class Product
            {
                public Int32 ProductID { get; set; }
                public string ProductName { get; set; }
            }
            private class Record
            {
                public string ProductID { get; set; }
                public string ProductDesc { get; set; }
            }
            void Page_Load()
            {
                var list = new List<Record>();
                list.Add(new Record()
                {
                    ProductID = "1",
                    ProductDesc = "Adjustable Race"});
                list.Add(new Record()
                {
                    ProductID = "2",
                    ProductDesc = "Bearing Ball"});
                FormView1.DataSource = list;
                FormView1.DataBind();
            }
        </script>
    </head>
    <body>
        <%Response.Write("<p>Results on "+ Request.ServerVariables["SERVER_SOFTWARE"] + " .net: " + System.Environment.Version + "</p>");%>
        <form id="form1" runat="server">
        <asp:FormView ID="FormView1"
            DataKeyNames="ProductID"
            RunAt="server">
            <ItemTemplate>
                <table>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductID")]<br><b>Product ID:</b></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ProductID") %></td>
                    </tr>
                    <tr>
                        <td align="right">[DataSourceID="ObjectDataSourceProducts";Bind("ProductID")]<br><b>Product Name:</b></td>
                        <td><asp:DropDownList ID="InsertCategoryDropDownList"
                            SelectedValue='<%# Bind("ProductID") %>'
                            DataSourceID="ObjectDataSourceProducts"
                            DataTextField="ProductName"
                            DataValueField="ProductID"
                            RunAt="Server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductDesc")]<br><b>Product Desc:</b></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ProductDesc") %></td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:FormView>
        <asp:GridView ID="grdCustomers" runat="server" DataSourceID="ObjectDataSourceProducts">
            <PagerStyle HorizontalAlign="Left" />
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSourceProducts" runat="server"
            TypeName=""
            DataObjectTypeName=""
            SelectMethod="GetProducts"
            UpdateMethod="SaveProduct"
            InsertMethod="SaveProduct">
        </asp:ObjectDataSource>
        </form>
    </body>
</html>
HTTP Response Output:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head id="Head1"><title>
	Sample Page
</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head>
    <body>
        <p>Results on Microsoft-IIS/8.5 .net: 4.0.30319.42000</p><form method="post" action="./aspnet_ht_findtypenamepropertyofobjectdatasource_001a.aspx_01.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="1+Xfu/VvU80rXJM5u+vHIX41amF2v/uRoIjRKlMfuausqJc+DC37aD40Mh7KUR1Q3iF4wcN9uQHTGww/GFpGnNp4tkSRKKIPq89nJzh5ukuAtb6nt3DvIMiQan30z4K2/bLYEWnU1Jw4JxLbYYWNRc+zkJF+baHuxQsYd+KTivDMg6zRfnYaZKCFn85K8Xpzi82hzQjpOnKuu1hEBtMccmk85DXgI118y8uxJlvMmeKPIe4gUlPJoz0rGgOtHCaRGrCk2CyOBEfYEYeiKNeC1ZX2JLMAk1xf+Il9/vzy27ylUzVUh2IYTAT+5tdCS6byEQguAmgX9kFuf6ZD6r1byjFh033t9n2wvis/cio+5mN595yfAdpsBoiG5mftFk/49n+VeYxmSF7IUXscxRIRUdfF30pxrxK89G8tOH3lKCalWqNC3Fw52t/4cH5b+Pn/nEon2AC+tQS8mXtmHJKTYiQ+NgdD/htoLyWQVhl69tTuO7lLoIf0d5y/jiKAAejETzSPJAaG3wPH39w4oKj0HUHPsfSGnHgCn9i34w3Lf9drexoWBP236YoI5gcLH/KR+NtyDKmI6g21DdF1MbpDm9DYVuQa9os4BfJ0rH0o2TQVQV7LSjU0SYLC0qvRJdq/uMJ9Rh6vGj/9qGbJcftFzNiGKGpIx1al74jzb05hduKNgj7V1N/jLkKxOZ9f95jB+kegCeVA1Uui5myHe+MDTv1uwtgHyEGI3Y3wIDtOFwV2FA0OhsWIxKUBL4LP70je" />
</div>

<div class="aspNetHidden">

	<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="072C24D9" />
	<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="KCuEa6EsXuLuAC95cBQMd9P8zmi5gs+cN46JR5xTu6ht0oMr5gOhLVnI4ooTuqbq1idxh9CAG6iaIp4lo04Q5WY9NnNN/7aQsWHFdDYyF0h8mbuZPQB6vFoGlFR/0Ehbj8UvlD8O+qlvqGB5oHKD4Oe8kRkktB1Y6HGgYdVR8Yc=" />
</div>
        <table cellspacing="0" id="FormView1" style="border-collapse:collapse;">
	<tr>
		<td colspan="2">
                <table>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductID")]<br><b>Product ID:</b></td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td align="right">[DataSourceID="ObjectDataSourceProducts";Bind("ProductID")]<br><b>Product Name:</b></td>
                        <td><select name="FormView1$InsertCategoryDropDownList" id="FormView1_InsertCategoryDropDownList">
			<option selected="selected" value="1">Product One</option>
			<option value="2">Product Two</option>

		</select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductDesc")]<br><b>Product Desc:</b></td>
                        <td>Adjustable Race</td>
                    </tr>
                </table>
            </td>
	</tr>
</table>
        <div>
	<table cellspacing="0" rules="all" border="1" id="grdCustomers" style="border-collapse:collapse;">
		<tr>
			<th scope="col">ProductID</th><th scope="col">ProductName</th>
		</tr><tr>
			<td>1</td><td>Product One</td>
		</tr><tr>
			<td>2</td><td>Product Two</td>
		</tr>
	</table>
</div>
         </form>
    </body>
</html>
HTML Web Page Embedded Output:

Examples of ASP.NET VB page

Examples of ASP.NET VB page
ASP.NET Code Input:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head id="Head1" runat="server">
        <title>Sample Page</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <%@ Page Language="vb" %>
        <script runat="server" >
            public Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
                ObjectDataSourceProducts.TypeName = sender.GetType().AssemblyQualifiedName
            End Sub

            Public Class Product
                Public Property  ProductID As Int32
                Public Property ProductName As String
            End Class

            Public Shared Function GetProducts() As List(Of Product)
                Dim Products As New List(Of Product)()
                Products.Add(New Product() With { _
                    .ProductID = "1", _
                    .ProductName = "Product One"})
                Products.Add(New Product() With { _
                    .ProductID = "2", _
                    .ProductName = "Product Two"})
                Return Products
            End Function

            Private Class Record
                Public Property  ProductID
                Public Property ProductDesc
            End Class

            Sub Page_Load()
                Dim list As new List(Of Record)()

                list.Add(new Record() With { _
                    .ProductID = "1", _
                    .ProductDesc = "Adjustable Race" })

                list.Add(new Record() With { _
                    .ProductID = "2", _
                    .ProductDesc = "Bearing Ball"})

                FormView1.DataSource = list
                FormView1.DataBind()
            End Sub
        </script>
    </head>
    <body>
        <%Response.Write("<p>Results on "& Request.ServerVariables("SERVER_SOFTWARE") & " .net: " & System.Environment.Version.ToString & " " & ScriptEngine & " Version " & ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "</p>")%>
        <form id="form1" runat="server">
        <asp:FormView ID="FormView1"
            DataKeyNames="ProductID"
            RunAt="server">
            <ItemTemplate>
                <table>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductID")]<br><b>Product ID:</b></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ProductID") %></td>
                    </tr>
                    <tr>
                        <td align="right">[DataSourceID="ObjectDataSourceProducts";Bind("ProductID")]<br><b>Product Name:</b></td>
                        <td><asp:DropDownList ID="InsertCategoryDropDownList"
                            SelectedValue='<%# Bind("ProductID") %>'
                            DataSourceID="ObjectDataSourceProducts"
                            DataTextField="ProductName"
                            DataValueField="ProductID"
                            RunAt="Server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductDesc")]<br><b>Product Desc:</b></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ProductDesc") %></td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:FormView>
        <asp:GridView ID="grdCustomers" runat="server" DataSourceID="ObjectDataSourceProducts">
            <PagerStyle HorizontalAlign="Left" />
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSourceProducts" runat="server"
            TypeName=""
            DataObjectTypeName=""
            SelectMethod="GetProducts"
            UpdateMethod="SaveProduct"
            InsertMethod="SaveProduct">
        </asp:ObjectDataSource>
        </form>
    </body>
</html>
HTTP Response Output:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head id="Head1"><title>
	Sample Page
</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /></head>
    <body>
        <p>Results on Microsoft-IIS/8.5 .net: 4.0.30319.42000 VB Version 14.0</p><form method="post" action="./aspnet_ht_findtypenamepropertyofobjectdatasource_001a.aspx_02.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="5kiz6Drun5NTaJDTFqF7FMWhaTzq6bCWToiuLiGbWvvQ+VUAFL6b0+6S3lXsj5fWqBjWHsVO4+/hs6rgXSjTHURqk2XkjwS4Oet+/GHONmDqnMTJdyY6lJ3sUufLWg3GYfS03ALtS/slRIJS2fav1xDVt71WJKBwexajHfU/6TQ/Pa/VeRhxGaF5XDiJyOwkGVxpux1QoGYK6qhYtEGAL75Gtv2KTDuno6FwkBnt3KfiHrs6dHg2EW8auBjmfgmRk+UsgJrCv7HjrgYSu28n7Y5TFoUjdop+LzP+06FnETC7dLhGRROdeFZWN+tkT9TcQCmMpyA+iAOq/tcMUAUV5mqSBkIyHyFv8HeMekNZ36fdikuPBLaWM8NfbfXZxPOC8m2mIaiFh6bmzpZGTAHNcXR3La22R3xnQeF8q6mWdktpuW8m/8DK1e7/9kt9S76Wxz9BfcpMS4/ZuXgCEIQrn71sfV5TuTnC4yJbDruXuZaHcqrQZTMHwkDa+NPv/d/4KAk+GW6QHsWVHCcmHuywvFny4Vpx9OeLE0TucoVoEoE99knaK4FLQ5ZE4yyk0c118tNS7Jaa8m1rEqD2UuzWWnUPqgeFEKL0DMbBRqVyhxfKDDCYRBMWg1YW/hENakRA6f0SN6xbOmLeWT2irRXrybRD3U9SaQCPLtXPuFh7JxVHFUDxDGS7ry/4vKPyI2YdCxHrOX4egya+RwEQjfEvIdPK3NW9lh12mFROaNW4LQLKBKLhSg9B2a/ORS4YuyQC" />
</div>

<div class="aspNetHidden">

	<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="7CE3A54F" />
	<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="0JTMw2msQUpcxH1A1P/5Kdh5UfLMA0OjNsWgPC6a1WNGWfh9dvOgwXjVEtfUZf7akUnTb4RCaAoGTCZP/qVTVVM8LpjLrle+3Exvni8ToSnfhRxwc87mhF5HGegxO2Wh8/R0ZyI/EBuMFr1INvsOBwueKtXuzwYPAP8pJi9M6B8=" />
</div>
        <table cellspacing="0" id="FormView1" style="border-collapse:collapse;">
	<tr>
		<td colspan="2">
                <table>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductID")]<br><b>Product ID:</b></td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td align="right">[DataSourceID="ObjectDataSourceProducts";Bind("ProductID")]<br><b>Product Name:</b></td>
                        <td><select name="FormView1$InsertCategoryDropDownList" id="FormView1_InsertCategoryDropDownList">
			<option selected="selected" value="1">Product One</option>
			<option value="2">Product Two</option>

		</select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">[DataBinder.Eval(Container.DataItem, "ProductDesc")]<br><b>Product Desc:</b></td>
                        <td>Adjustable Race</td>
                    </tr>
                </table>
            </td>
	</tr>
</table>
        <div>
	<table cellspacing="0" rules="all" border="1" id="grdCustomers" style="border-collapse:collapse;">
		<tr>
			<th scope="col">ProductID</th><th scope="col">ProductName</th>
		</tr><tr>
			<td>1</td><td>Product One</td>
		</tr><tr>
			<td>2</td><td>Product Two</td>
		</tr>
	</table>
</div>
         </form>
    </body>
</html>
HTML Web Page Embedded Output:

Sources and References

  • https://stackoverflow.com/questions/20328819/the-type-specified-in-the-typename-property-of-objectdatasource-could-not-be-fou

©sideway

ID: 211000028 Last Updated: 10/28/2021 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 337

Reference 68

Computer

Hardware 156

Software

Application 207

Digitization 25

Latex 35

Manim 203

Numeric 19

Programming

Web 285

Unicode 504

HTML 65

CSS 65

SVG 9

ASP.NET 270

OS 422

DeskTop 7

Python 66

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 32

Coordinate Geometry 1

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2021 Sideway . All rights reserved Disclaimers last modified on 06 September 2019