<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="ObjectDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="EditorComment" HeaderText="EditorComment"
SortExpression="EditorComment" HtmlEncode="false" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="Author" HeaderText="Author"
SortExpression="Author" />
<asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" />
<asp:BoundField DataField="ImageId" HeaderText="ImageId"
SortExpression="ImageId" HtmlEncode="false"/>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
<asp:BoundField DataField="WordCount" HeaderText="WordCount"
SortExpression="WordCount" />
<asp:BoundField DataField="BookName" HeaderText="BookName"
SortExpression="BookName" />
<asp:BoundField DataField="PublishDate" HeaderText="PublishDate"
SortExpression="PublishDate" />
<asp:BoundField DataField="ContentDescription" HeaderText="ContentDescription"
SortExpression="ContentDescription" />
<asp:BoundField DataField="Clicks" HeaderText="Clicks"
SortExpression="Clicks" />
<asp:BoundField DataField="AuthorDescription" HeaderText="AuthorDescription"
SortExpression="AuthorDescription" HtmlEncode="false" />
</Fields>
<FooterStyle BackColor="#cccccc" />
<EditRowStyle BackColor="#000099" Font-Bold="true" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="Black" Font-Bold="true" ForeColor="White" />
<AlternatingRowStyle BackColor="#cccccc" />
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetBookById" TypeName="BookBLL.BookManager">
<SelectParameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
其中有测过了,Id可以传过来,但不能通过方法GetBookById(int Id)获取对象,
我在测试中是用int id = convert.ToInt32(Request.QueryString["id"]),获取Id在传入方法,但获取不到对象
但用实际数子GetBookById(4)是可以获取对象的,
各位高手帮帮忙,我实在是做不出来
DataSourceID="ObjectDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="EditorComment" HeaderText="EditorComment"
SortExpression="EditorComment" HtmlEncode="false" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="Author" HeaderText="Author"
SortExpression="Author" />
<asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" />
<asp:BoundField DataField="ImageId" HeaderText="ImageId"
SortExpression="ImageId" HtmlEncode="false"/>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
<asp:BoundField DataField="WordCount" HeaderText="WordCount"
SortExpression="WordCount" />
<asp:BoundField DataField="BookName" HeaderText="BookName"
SortExpression="BookName" />
<asp:BoundField DataField="PublishDate" HeaderText="PublishDate"
SortExpression="PublishDate" />
<asp:BoundField DataField="ContentDescription" HeaderText="ContentDescription"
SortExpression="ContentDescription" />
<asp:BoundField DataField="Clicks" HeaderText="Clicks"
SortExpression="Clicks" />
<asp:BoundField DataField="AuthorDescription" HeaderText="AuthorDescription"
SortExpression="AuthorDescription" HtmlEncode="false" />
</Fields>
<FooterStyle BackColor="#cccccc" />
<EditRowStyle BackColor="#000099" Font-Bold="true" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="Black" Font-Bold="true" ForeColor="White" />
<AlternatingRowStyle BackColor="#cccccc" />
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetBookById" TypeName="BookBLL.BookManager">
<SelectParameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
其中有测过了,Id可以传过来,但不能通过方法GetBookById(int Id)获取对象,
我在测试中是用int id = convert.ToInt32(Request.QueryString["id"]),获取Id在传入方法,但获取不到对象
但用实际数子GetBookById(4)是可以获取对象的,
各位高手帮帮忙,我实在是做不出来
解决方案 »
- 大侠进 菜鸟在线等...
- 如何使用TabControl,
- 探讨以下绑定时候的字段截取方式,那个更快一些
- 找不到指定的模块的错误 急
- 读取不了TextBox内容问题
- ★★★★★★没分!!怎么再图片的4个角写上版权呢★★★★★
- 在*.aspx页面中如何控制IE界面?
- 大侠 请解释一下<body MS_POSITIONING="GridLayout"> MS_POSITIONING是什么意思呀,
- treeview 中的点击时间响应问题,100分期盼高手指点!!!
- 如何取得textbox的最新值?请高手帮忙
- 数据抓取
- System.Data.SqlClient.SqlException: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下
int id = convert.ToInt32(Request.QueryString["id"])
这个id获得了吗???
如果能获得,则DetailsView中设置的
<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="Int32" />
也一定能够获得!!
<asp:Parameter Name="Id" Type="Object" />
</SelectParameters>protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["Id"] = int.Parse(this.Page.Request["id"]);
}这样,你的代码就可以做任何中间处理和转换。
e.InputParameters["pg"] = this.Page;等等。