Urgent- Please help me

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
 
B

Brian Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top