You must Sign In to post a response.
Category: ASP.NET
#766523
Hi
you can try this code for hyperlink and navigate another Page Details show in label Fields.
Client Side
Server Side
Name : Dotnet Developer-2015
Email Id : kumaraspcode2009@gmail.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.
you can try this code for hyperlink and navigate another Page Details show in label Fields.
Client Side
<asp:GridView ID="DtgProduct" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText = "Id" ItemStyle-Width="30">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Id", "~/ViewDetails.aspx?Id={0}") %>'
Text='<%# Eval("Id") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Product" HeaderText="Product" ItemStyle-Width="150" />
<asp:BoundField DataField="Amount" HeaderText="Amount" ItemStyle-Width="150" />
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# string.Format("~/ViewDetails.aspx?Id={0}&Product={1}&Amount={2}",
HttpUtility.UrlEncode(Eval("Id").ToString()), HttpUtility.UrlEncode(Eval("Product").ToString()), HttpUtility.UrlEncode(Eval("Amount").ToString())) %>'
Text="View Details" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Server Side
if (!this.IsPostBack)
{
lblId.Text = HttpUtility.UrlDecode(Request.QueryString["Id"]);
lblProductName.Text = HttpUtility.UrlDecode(Request.QueryString["Product"]);
lblAmountText = HttpUtility.UrlDecode(Request.QueryString["Amount"]);
}
Name : Dotnet Developer-2015
Email Id : kumaraspcode2009@gmail.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.
#766537
Hi,
Kindly Go through the Below Mentioned Links regarding view the data from database while clicking the Link Button in Gridview. It may Helps you lot to do your requirement.
1.http://www.c-sharpcorner.com/uploadfile/anjudidi/select-update-and-delete-data-in-a-Asp-Net-gridview-control/
2.http://www.aspdotnet-suresh.com/2014/11/delete-row-from-gridview-using-link-button-click-in-aspnet-with-confirmation.html
3.http://www.dotnetfunda.com/articles/show/29/updating-deleting-records-using-gridview-control
Regards,
Karunanidhi.K
Kindly Go through the Below Mentioned Links regarding view the data from database while clicking the Link Button in Gridview. It may Helps you lot to do your requirement.
1.http://www.c-sharpcorner.com/uploadfile/anjudidi/select-update-and-delete-data-in-a-Asp-Net-gridview-control/
2.http://www.aspdotnet-suresh.com/2014/11/delete-row-from-gridview-using-link-button-click-in-aspnet-with-confirmation.html
3.http://www.dotnetfunda.com/articles/show/29/updating-deleting-records-using-gridview-control
Regards,
Karunanidhi.K
#766541
Hi,
What you have tried so far?
Without tried out by your self simply posting for others help that won't helpful to you to learn any technology.
As per your query when you click linkbutton inside gridview you have to perform some action over there, this task you can achieve in no of ways.
1) Using GridView RowCommand event, pass CommandName for that linkbutton and use that linkbutton commandname you need to perform action in rowcommand event of gridview, for more details refer below link.
http://www.aspsnippets.com/Articles/ASP.Net-GridView---Get-Row-Index-on-RowCommand-and-Click-events.aspx
2) Using Gridview HyperLinkField template you can achieve this, refer below link for more details
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkfield.navigateurl(v=vs.110).aspx
and coming back to your question again, you need to fetch data from database after perform this action, so you need to get data from database and bind the same as you want.
--------------------------------------------------------------------------------
Give respect to your work, Instead of trying to impress your boss.
N@veen
Blog : http://naveens-dotnet.blogspot.in/
What you have tried so far?
Without tried out by your self simply posting for others help that won't helpful to you to learn any technology.
As per your query when you click linkbutton inside gridview you have to perform some action over there, this task you can achieve in no of ways.
1) Using GridView RowCommand event, pass CommandName for that linkbutton and use that linkbutton commandname you need to perform action in rowcommand event of gridview, for more details refer below link.
http://www.aspsnippets.com/Articles/ASP.Net-GridView---Get-Row-Index-on-RowCommand-and-Click-events.aspx
2) Using Gridview HyperLinkField template you can achieve this, refer below link for more details
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkfield.navigateurl(v=vs.110).aspx
and coming back to your question again, you need to fetch data from database after perform this action, so you need to get data from database and bind the same as you want.
--------------------------------------------------------------------------------
Give respect to your work, Instead of trying to impress your boss.
N@veen
Blog : http://naveens-dotnet.blogspot.in/
#766598
Create page with link button, From the link button you can navigate the page. If you want you can send some input data using the query string. It is depend on your requirement. In the page load you can make the DB call and get the data from the database. Once you get the data source you can do the data binding to the GridView.
In Aspx page create the control for Gridview. If you do not have any logic to handle in the link button just navigate the same page.
By Nathan
Direction is important than speed
In Aspx page create the control for Gridview. If you do not have any logic to handle in the link button just navigate the same page.
<script language="C#" runat="server">
void LinkButton_Click(Object sender, EventArgs e)
{
MyGridView.DataSource = aDataTableL;
MyGridView.DataBind();
}
</script>
< asp:LinkButton id="LinkButton1"
Text="Click Me"
Font-Names="Verdana"
Font-Size="14pt"
OnClick="LinkButton_Click"
runat="server"/>
<asp:GridView ID="MyGridView" runat="server" Width="550px"
AutoGenerateColumns="true" ShowFooter="true">
</asp:GridView>
By Nathan
Direction is important than speed
Return to Return to Discussion Forum