Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Enable / Disable a control in ModelPopupExtender with Stream

$
0
0

Hi

i am working on a Itextsharp pdf. i have button in my ModelPopUpExtender called"Print". in this button i am creating and printing new pdf document. everything is working fine. i also have two more buttons called "Accept" and "Not Accept", both are disable when page loads. my requirement is when i press Print button, along with the printing of pdf document "Accept" and "Not accept" button get Enable. i tried almost all ways to get it work :(. there is definitely aconflict with pdf document stream. my code is as under.

<asp:Panel ID="Panel1" runat="server" Style="background-color: #F8FBE9; display: nosne;">
<table width="500px">
<tr>
<td >
Sales form
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<asp:LinkButton ID="btnAccptChk" runat="server" ValidationGroup="grpCCForm" OnClick="btnAccptChk_Click"
Enabled="false"><img src="../images/AcceptCheck.png" alt="Accept" /></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnNotaccptChk" runat="server" ValidationGroup="grpCCForm" Enabled="false"><img src="../images/NotAcceptCheck.png" alt="Accept"/></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnPrint" runat="server" ValidationGroup="grpCCForm" OnClick="btnPrint_Click" OnClientClick="alert('test');"> <img src="../images/Print.bmp" alt="Print" /></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnExit" runat="server" OnClick="btnExit_Click"> <img src="../images/Exit.bmp" /></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</asp:Panel>

<asp:ModalPopupExtender ID="mdlForm" runat="server" TargetControlID="btnopen" BackgroundCssClass="modalBackground"
PopupControlID="Panel1" CancelControlID="btnClose">
</asp:ModalPopupExtender>

in UpdatePanel i have following code.

<Triggers>
<asp:PostBackTrigger ControlID="btnPrint" />
</Triggers>

on Server side in Print_Click Event follwing code is written.

var document = new Document(PageSize.LETTER, 0, 0, 0, 0);

// Create a new PdfWrite object, writing the output to a MemoryStream
var output = new MemoryStream();
var writer = PdfWriter.GetInstance(document, output);
var basefont = BaseFont.CreateFont("c:\\windows\\fonts\\tahoma.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

//Create our paragraph
Paragraph PrAmount1 = new Paragraph();

PrAmount1.Add(new Chunk("Test Paragraph", CellFont));
PrAmount1.Add(Chunk.NEWLINE);
col.AddText(PrAmount1);
col.Go();

writer.CloseStream = false;
document.Close();
output.Position = 0;

Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Receipt-{0}.pdf", txtNextCheckNo.Text));
Response.BinaryWrite(output.ToArray());


btnAccptChk.Enabled = true;
btnNotaccptChk.Enabled = true;

When i try enable code in any other button on the popup it work fine. but with pdf stream it is not. Anybody please help me to solve this problem. Thanks in Advance.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>