.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

GridView

Posted By: R@j     Posted Date: January 19, 2009    Points:2   Category :ASP.Net
Hai

I have GridView.In that I am using linkbutton to Redirect to next page by taking ID.I wrote code in RowCommana.But the event was not fired.

Can anyone please Help me.

Thanks in Advance

Responses
Author: Praveen             
Posted Date: January 19, 2009     Points: 5   

I guess you are binding the gridview in side Page_Load Event. if yes then Just Check whether it IsPostBack or not like this


protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
// Bing your datagrid here.
}
}


Happy Coding
Praveen!!!

Author: Kumar             
Posted Date: January 21, 2009     Points: 5   

Hi Raja,

Please give CommandName for the link button and than in Rowcommand event
for example if the linkbutton cammandname="save'

Please check

if(e.commandName=="save")
{
// do the operation
}


Thanks and regards,
Kumar

Author: Athira Sreejith             
Posted Date: February 02, 2009     Points: 5   

Try like this..

protected void GvFirmDetail_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

string ContactRowId = ((Label)e.Row.Cells[0].FindControl("lblId")).Text;
ImageButton btnContact = new ImageButton();
btnContact = (ImageButton)e.Row.Cells[7].FindControl("btnAddContact");
btnContact.Attributes.Add("OnClick", "new_window('Prospectscontact.aspx?PFid=" + ContactRowId + "','sample','scrollbars=yes','width=300,height=380')");

}
}



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend