数据未显示在“详细信息视图"控件中 [英] Data not being displayed in Details View control

查看:86
本文介绍了数据未显示在“详细信息视图"控件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在详细信息视图控件中显示数据.数据将是客户订购的产品列表.我已经创建了存储过程来获取此列表,它可以完美工作.但是在网页上,列表未显示,视图为空白.
由于产品列表属于当前登录的用户,因此对于详细信息视图控件,我将Session作为参数源",并将Session字段作为"User.Identity.Name".这些值有误吗?

[更新]

I want to display data in details view control. Data will be the list of products ordered by the customer. I have created stored procedure to get this list and it works perfect. But on the web page, the list is not displayed, view is blank.
Since the product list belongs to the user who is currently logged in, I have taken Session as the ''Parameter source'' and Session Field as''User.Identity.Name'' for the details view control. Are these values wrong?

[Update]

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 

        DataSourceID="SqlDataSource2" 

        style="z-index: 1; left: 338px; top: 222px; position: absolute; height: 121px; width: 175px">
        <Columns>
            <asp:BoundField DataField="textDesc" HeaderText="textDesc" 

                SortExpression="textDesc" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 

        ConnectionString="<%$ ConnectionStrings:MYDataBaseConnectionString %>" 

        SelectCommand="VIEW_MY_ORDER" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:SessionParameter Name="CLIENT" SessionField="User.Identity.Name" 

                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>



SQL查询产生正确的结果,我认为问题出在上面的代码中



SQL query is producing correct results,I think the problem is in the above code

推荐答案

ConnectionStrings:MYDataBaseConnectionString%>" span> SelectCommand =" VIEW_MY_ORDER" SelectCommandType StoredProcedure" < SelectParameters > < asp:SessionParameter 名称 =" SessionField User .Identity.Name" span> 类型 字符串" / > < /SelectParameters > < /asp:SqlDataSource >
ConnectionStrings:MYDataBaseConnectionString %>" SelectCommand="VIEW_MY_ORDER" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="CLIENT" SessionField="User.Identity.Name" Type="String" /> </SelectParameters> </asp:SqlDataSource>



SQL查询产生正确的结果,我认为问题出在上面的代码中



SQL query is producing correct results,I think the problem is in the above code


User.Identity.Name不是SessionField.会话字段是您在其中执行过Session ["fieldName"] = User.Identity.Name之类的任何字段.因此,将User.Identity.Name存储到SessionField(可能称为UserName)中,然后将会话参数更改为来自UserName.

User.Identity.Name is not a SessionField. A session field is any field where you did something like Session["fieldName"] = User.Identity.Name. So, store User.Identity.Name into a SessionField, maybe called UserName and then change your session parameter to come from UserName.

Session["UserName"] = User.Identity.Name;





SessionField="UserName" 


这篇关于数据未显示在“详细信息视图"控件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆