开发者

hyperlink in a item template inside the gridview

I have this hyperlink in a item template inside the gridview

 <asp:TemplateField Headertext ="SN0">
        <ItemTemplate>


       <asp:Hyperlink runat= "server" Text='<%# DataBinder.Eval(Container.DataItem,"Container.DataItemIndex + 1")%>' 
                          NavigateUrl='<%# "ResolveComplaint.aspx?Name=" & DataBinder.Eval (Container.DataItem,"ComplaintProfileId").tostring & _  
                          "&Status=" & DataBinder.Eval(Contain开发者_如何转开发er.DataItem,"Status").tostusring %>' ID="Hyperlink2"/>   
        </ItemTemplate>
        </asp:TemplateField>

Basically, I am trying to make the first column(SN0) in a gridview. On click on the hyperlink, it redirects to another Page. I am carrying ComplaintProfileId, Status fields to the next page This gives me a compiletime error: Compiler Error Message: CS1026: ) expected

Thanks Sun


The problem is when you are trying to set the NavigateUrl property. You are using the & for concatenation, but you have to use the + sign for that. e.g.

 NavigateUrl='<%# "ResolveComplaint.aspx?Name=" + DataBinder.Eval (Container.DataItem,"ComplaintProfileId").tostring +  
                      "&Status=" + DataBinder.Eval(Container.DataItem,"Status").tostusring %>'


Should your .tostring and tostusring calls be .ToString()?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜