?
Solved

HyperlinkColumn in Datagrid

Posted on 2005-03-24
5
Medium Priority
?
357 Views
Last Modified: 2012-05-05
How do I pass more than one column in query string when used in a datagrid hyperlinkcolumn ?

xxx.aspx?column1={0}&column2= ?
0
Comment
Question by:DavidTanis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 13626255
I personally avoid the HyperlinkColumn in favor of a templatecolumn, you have much more control over the final product...Just use <%# .. %> wherever you need the additional information in the url.

                        <asp:templatecolumn>
                              <itemtemplate>
                                    <a href='Summary.aspx?column1=<%# DataBinder.Eval(Container.DataItem, "column1") %>'>View Something <%# DataBinder.Eval(Container.DataItem, "whatever") %></a>
                              </itemtemplate>
                        </asp:templatecolumn>
0
 
LVL 6

Expert Comment

by:Havagan
ID: 13627017
And I on the other hand use a TemplateColumn with a Hyperlink control. =)

<asp:templatecolumn>
<itemtemplate>
<asp:hyperlink NavigateUrl='xxx.aspx?column1=<%# DataBinder.Eval(Container.DataItem, "column1") %>&column2=<%# DataBinder.Eval(Container.DataItem, "column2") %>' Text='<%# DataBinder.Eval(Container.DataItem, "columntodisplay") %>'></asp:hyperlink>
</itemtemplate>
</asp:templatecolumn>

Paul
0
 
LVL 7

Expert Comment

by:ayha1999
ID: 13629798
hi,

try this:

<asp:HyperLink ID="VariableName" Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"YourFieldToDisplay") %>' NavigateUrl='<%# String.Format("YourPage.aspx?FieldName1toPass={0}&FieldName2toPass={1}&FieldName3toPass={2}&FieldName4toPass={3}",DataBinder.Eval(Container.DataItem, "FieldNo1"),DataBinder.Eval(Container.DataItem, "FieldNo2"),DataBinder.Eval(Container.DataItem, "FieldNo4"),DataBinder.Eval(Container.DataItem, "FieldNo5"))%>'</asp:HyperLink>

Hope this helps.

ayha
0
 

Author Comment

by:DavidTanis
ID: 13629882
<asp:TemplateColumn SortExpression="Count" HeaderText="Count">
<ItemTemplate>
<asp:HyperLink id=HyperLink1 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cnt") %>' NavigateUrl='xxx.aspx?a=<%# DataBinder.Eval(Container.DataItem, "a") %>&b=<%# DataBinder.Eval(Container.DataItem, "b") %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>

When I looked into the querystring, the value for "a" was retrived as "<%" , not the value in column a. and "b" shows nothing.

Is it missing anything in the code? Thanks

0
 
LVL 7

Accepted Solution

by:
ayha1999 earned 1000 total points
ID: 13629958
Try this;

<asp:HyperLink id=HyperLink1 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cnt") %>'  NavigateUrl='<%# String.Format(xxx.aspx?a={0}&b={1}",DataBinder.Eval(Container.DataItem, "a"),DataBinder.Eval(Container.DataItem, "b"))%>'>

Hope this works.

ayha
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question