Urgent- Please help me

  • Thread starter Thread starter settyv
  • Start date Start date
S

settyv

Hi,

How do i call the below function on click of datagrid row.I want to
use hyperlink column.How do i call this function from hyperlink column
in a datagrid.


public MemoryStream GetMinuteOrderPdf(SearchParams sp)
{
DMS dms = new DMS();

sp.IsMinuteOrder = true;

return dms.getDocument(sp);
}


ASPX code:

<column>
<asp:TemplateColumn >
<ItemTemplate>
<asp:LinkButton ID="linkView" runat="server"
CausesValidation="false" CommandName="View"
Text="View PDF"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</column>

Code Behind:

protected void DataGrid1_ItemDataBound(object sender,
DataGridItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
LinkButton btn = e.Item.FindControl("linkView") as
LinkButton;


e.Item.Attributes["onclick"] =
GetMinuteOrderPdf(SearchParams sp);




btn.Style[HtmlTextWriterStyle.Display] = "none";


}
}


Will this work? Please let me know.

Thanks,
Vishnu
 
If you don't mind a post back then you could store the search parameters in
a hidden textbox. Then look for the values and if present with
if(IsPostBack) use them then clear the textbox.

The better solution would be to use ASP.Net AJAX.

Regards,
Brian K. Williams
 
Back
Top