English 中文(简体)
VB.NET 学历
原标题:VB.NET QueryString

我正在使用数据网,我有<代码><asp:Template Field>。 我在守则中通过了以下一些参数:

<asp:TemplateField HeaderText="Download">
    <ItemTemplate>
        <asp:LinkButton ID="lnkname" runat="server" Text="Download" PostBackUrl= <%#"~/logout.aspx?ID="+Eval("ID")+"&category=mobile"%> ></asp:LinkButton>
    </ItemTemplate>
</asp:TemplateField>

我有数字领域,我需要通过URL进行发送,试图发送“强盗”数据及其工作罚款,但我寄出数字类型(ID)时,我正面临这一错误。

将“~/logout.aspx?ID=”改为“双重”是不有效的。

我知道,我需要改动<代码>Eval(ID)附近的辛醇。 我应如何在询问中提供数字数据?

增 编

最佳回答
<asp:TemplateField HeaderText="Download">
                <ItemTemplate>
               <asp:LinkButton ID="lnkname" runat="server" Text="Download" PostBackUrl= <%# String.Format("~/logout.aspx?ID={0}&category=mobile", Eval("ID")) %> ></asp:LinkButton>
               </ItemTemplate>
               </asp:TemplateField>
问题回答

The <%# syntax should only be used for evaluation a specific data items. 你们正试图在<代码>和>上架设全座标;%#,因为大多数数据都是静止的。

就你为何在<代码>上发现错误仅作一 。 ID specific prospects is which You have the full items string and double information in their binding <%# 它使用<代码>的类型。 Eval 说明整个章节的内容。 在您的情形下,它正在研究<代码>Eval("ID”)的价值,并且知道该代码为double<>code/code>,然后预计约束结果为double<>。 问题在于你召集了<条码>载和<条码>杜布尔,以便希望填上<条码>的<条码>,根据<条码>的预期类型,该代码无效。 Eval

在将数据发送至<代码>querystring时,将使用string。 当你使用<代码>QueryString将其贴出时,该编码也随之退回。 您的代码是否与<条码>相仿?

如果贵国的法典没有检查空值,或填写<代码>TryParse,那么你可能会有错误。 牢记任何人都可以操纵这一数据,以便你核实数据是适当的。

例如:

Dim yourValue As Double = 0
If Double.TryParse(Request.QueryString("id"), yourValue) = False Then
    ShowError("Invalid id supplied.")
    Return
End If




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签