C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




GridView Error


Posted Date: 30 Aug 2008      Total Responses: 2

Posted By: Chandra Sheker.G       Member Level: Gold     Points: 1



Here I am Passing two colums Empid,Acc_By when i claick on hyperlink in gridView But i Want to pass two more Columns in url ie.Empid,Acc_by,LC,Acc.
Pls Correct my code.
<asp:GridView ID="GridView1" runat="server" Height="252px" Style="z-index: 100; left: 22px;
position: absolute; top: 130px" Width="823px" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="False">
<FooterStyle BackColor="Black" ForeColor="#330099" />
<Columns>
<asp:TemplateField HeaderText="EmpID">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("EmpID").ToString() %>'
NavigateUrl='<%# "Details.aspx?empid="+Eval("empid").ToString()+"&Audit_by="+Eval("Acc_by")+"&'></asp:HyperLink>

</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Acc_BY" HeaderText="AUDIT BY" />
<asp:BoundField DataField="DEPID" HeaderText="DEPID" />
<asp:BoundField DataField="POSID" HeaderText="POSID" />
<asp:BoundField DataField="LC" HeaderText="LC" />
<asp:BoundField DataField="ACC" HeaderText="ACC" />
<asp:BoundField DataField="AccWob" HeaderText="ACCWOB" />
</Columns>
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<PagerStyle BackColor="Black" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" BorderColor="Transparent" />
</asp:GridView>





Responses

Author: Aju M Nair    30 Aug 2008Member Level: SilverRating:     Points: 5

You can use a Hyperlink field,insted of the hyper link
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="444px">
<Columns>
<asp:ButtonField DataTextField="id" Text="Button" />
<asp:ButtonField DataTextField="name" Text="Button" />
<asp:HyperLinkField DataNavigateUrlFields="id,name" DataNavigateUrlFormatString="default.aspx?id={0}&name={1}" DataTextField="click to view details" />
</Columns>
</asp:GridView>

The above given code will pass the values of the first two colums,of the selected row to the next page.




Author: krishnasamy    30 Aug 2008Member Level: SilverRating:     Points: 4

Hi,
you can use Hyperlinkfield or Href.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="444px">
<Columns>
<asp:ButtonField DataTextField="id" Text="Button" />
<asp:ButtonField DataTextField="name" Text="Button" />
<a href="moduledocuments.aspx?id=<%#Eval["id"] %>&folderid=<%#Eval("ItemID") %>">
</Columns>
</asp:GridView>





Post Reply
You must Sign In to post a response.
Next : Plz give me some idea regarding iis settings
Previous : problem
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use