Very Urgent - Please suggest me a solution

S

settyv

Hi,

Please help me how can i call the below function on click of datagrid
hyperlink column.


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

sp.IsMinuteOrder = true;

return dms.getDocument(sp);//it returns the PDF memory stream
}




ASPX code:

<asp:TemplateColumn HeaderText="Minute Order" >
<ItemTemplate>
<asp:HyperLink
NavigateUrl=<%#GetMinuteOrderPdf(DataBinder.Eval(Container.DataItem,"Minute
Order"))%> ></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>


Please help me how can i call this function.Is there any way to do
this?


Thanks,
Vishnu
 
G

Guest

You can't do it from a hyperlink column as that does not create the event. If
you MUST use a hyperlink column, then call a new page (or pass a querystring
parameter to this page) and call the function from that.

You would normally use a linkbutton or button to cause an event, then in
that event, generate your PDF.

Hope this helps.

Regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Portal franchises available
 
S

settyv

Thanks for your suggestion.So you meant to say that the below code will
work assuming that i declared linkbutton in the datagrid control:

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

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


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


}
}

Please comment on this.

Thanks,
Vishnu
 
D

David

Hi,

I can't see anything wrong with that, though there may be some others with
more experience than me that might be able to see any potential issues.

Best regards,
Dave Colliver.
http://www.BracknellFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


Thanks for your suggestion.So you meant to say that the below code will
work assuming that i declared linkbutton in the datagrid control:

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

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


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


}
}

Please comment on this.

Thanks,
Vishnu

David said:
You can't do it from a hyperlink column as that does not create the
event. If
you MUST use a hyperlink column, then call a new page (or pass a
querystring
parameter to this page) and call the function from that.

You would normally use a linkbutton or button to cause an event, then in
that event, generate your PDF.

Hope this helps.

Regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Portal franchises available
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top