|
Hi all,
in my website i need to concatenate some memory streams and export like
response.binarywrite(memorystream.toarray())
in the memory stream i need to concatenate some more memory streams also,
how to do this, is it possible by means of changing by bytes or something like that??
please help me
|
|
|
|
|
Do you mean something like this?
MemoryStream MS1 = new MemoryStream(new byte[] { 0x01, 0x02, 0x03 });
MemoryStream MS2 = new MemoryStream(new byte[] { 0x04, 0x05, 0x06 });
MemoryStream MS3 = new MemoryStream();
MS3.SetLength(MS1.Length + MS2.Length);
MS3.Write(MS1.ToArray(), 0, (int)MS1.Length);
MS3.Write(MS2.ToArray(), 0, (int)MS2.Length);
Byte[] Result = MS3.ToArray();
foreach (Byte B in Result)
Response.Write(B.ToString() + " ");
Steve Wellens
|
|
|
|
|
thanks for your response,
i tried this code,
but in your code the second line MS3.write will over write(replace) the MS1.
that is my problem here as i am unable to write over, can you tell me more please
|
|
|
|
|
Really?
I included test output and it looked like this:
1 2 3 4 5 6
Nothing was overwritten.Steve Wellens
|
|
|
|
|
DataTable dt = new DataTable();
dt = _dal.ExecuteQuery_Out("select * from table1");
ReportDocument[] rd = new ReportDocument[2];
rd[0] = new ReportDocument();
rd[0].Load(Server.MapPath("ResultReport.rpt"));
rd[0].SetDataSource(dt);
dt = new DataTable();
dt = _dal.ExecuteQuery_Out("select * from table2");
rd[1] = new ReportDocument();
rd[1].Load(Server.MapPath("ResultReport.rpt"));
rd[1].SetDataSource(dt);
MemoryStream Parent1 = new MemoryStream();
MemoryStream[] Parentar = new MemoryStream[2];
byte[] parent = new byte[2];
//MemoryStream Mem;
//Mem = (MemoryStream)rd1.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
//byte[] bytearray = Mem.ToArray();
int h = 1;
for (int i = 0; i < rd.Length; i++)
{
Parentar[i] = (MemoryStream)rd[i].ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
//Array.Copy(Mem.ToArray(), parent, h);
//h++;
//((byte[])Mem.ToArray()).CopyTo(parent, h);
//h = ((byte[])Mem.ToArray()).Length + 1;
}
long length = 0;
for (int i = 0; i < Parentar.Length; i++)
{
length += Parentar[i].Length;
Parentar[i].Close();
}
Parent1.SetLength(length);
for (int i = 0; i < Parentar.Length; i++)
{
/* your code*/
Parent1.Write(Parentar[i].ToArray())
/* my code*/
byte[] b = Parentar[i].ToArray();
foreach (byte b1 in b)
Parent1.WriteByte(b1);
}
Parent1.Close();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(Parent1.ToArray());
here i should get both the report documents result in the pdf,
am i correct..
actually simulatenously i was working and i did some codes though here..
but am getting the last things in the out put..am i not dealing with the streams correctly like closing at appropriate place?
even in the debug mode the Parent1 current postiion is increasing while looping the second one..but am not getting
|
|
|
|
|
Concatenating memory streams is available only in .Net version 4. Means there is no option of doing that in previous versions.
you have to implement programming logic to achieve this.
|
|
|
|
|
i Tried with programing though ..
but the problem is i am getting the latest thing which is written and am not getting all? 
|
|
|
|
|
Hi, I had set up a pdf maker script using ASPpdf and it had been working fine for several months. Now, when the user trys to create a pdf, they get an Invalid Registration Key error. I looked in regedit for the key as directed in the original instructions and it is there. I don't work with asp.net everyday and haven't done any asp coding in about a year. We had some trouble with the server and our network guys did some work rebuilding. there is a run command showing in the run dropdown that I guess one of the network guys ran. regsvr32 d:\Inetpub\wwwroot\bin\ASPPDFLib.dll
I'm at a loss at what to do.
the line generating the error is below, in C#.
IPdfDocument objDoc = objPdf.CreateDocument( Missing.Value );
Thanks for any help you might provide.
|
|
|
|
|
i building a application web
i have 2 sever
server 1 "ip public". page web. php
server 2 "Local network" .net2.0 - web services
the server 1 should be the one to use the web services - server 2
i need to secure the web services,
how secure the web services?
1- ws security
2- other alternative . How?modified on Saturday, February 20, 2010 7:11 PM
|
|
|
|
|
Well, your question makes no sense. Please rephrase it so that someone can understand it. Best wishes,
Navaneeth
|
|
|
|
|
how to play movie clips and .swf file in .net 3.5v (asp.net)
|
|
|
|
|
Click the "Play" button. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I would like to have an option on the website for people to click and launch a popup. This popup would be like a chat window which always remains on the computer window wherever you drag it. So you can browse the site and still have this popup in the corner. how would we go about doing this?
|
|
|
|
|
Maybe you must watch at Here[^]... but this can't be in every page, so you may effort
|
|
|
|
|
Thanks. I see the example of having the window on the page but would I be able to place the window outside of the page and give the user the ability to move it where ever they want to.
|
|
|
|
|
Have some questions:
Until now edit it so that when you click on the edittemplate appears.
See Picture
Is it possible to change it in such a way that the EditItemTemplate appears when you click on the BoundField ?
|
|
|
|
|
Hi! i've seen that you've solved your row sorting problem! nice! but now your problem is? you have to read the RowUpdating event and also use the RowCommand event! if you click the 'edit' command, c# runs in RowUpdating event and then fires RowCommand (using e.CommandName as "Edit"). using this you can hide or make visible the columns. ex.
foreach (GridViewRow r in GV_ServiciosDetalles.Rows)
{
((Panel)r.FindControl("Panel1")).Style.Remove("display");
((Panel)r.FindControl("Panel2")).Style["display"] = "none";
} So in panel 1 you have a label with Text='<%#Eval("YourBoundField")%>' and in panel 2 you have a textbox with same thing. good luck
|
|
|
|
|
 Im usin a GridView, Edit, Update, Delete and Cancel are already exist.
Below the Header: SkillGroup is the BoundField and i try to click of the Boundfield.
i aint have no labels. Just boundfield visible ="true"
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CellPadding="4"
AllowSorting="True" DataKeyNames="SKillGroupID,rank_order" ForeColor="#666666"
OnRowCancelingEdit="GrizzdView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting"
OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" BackColor="#FF6600"
BorderColor="Black" Font-Bold="True" GridLines="Horizontal" Font-Size="Medium"
Font-Strikeout="False" OnRowCommand="GridView1_RowCommand">
<FooterStyle BackColor="#FF8000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:CommandField HeaderText="Edit-Update" ShowEditButton="True" />
<asp:BoundField DataField="SkillGroupID" Visible="false" ReadOnly="True" />
<asp:BoundField DataField="SkillGroupName" HeaderText="SkillGroup" />
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="Server" ImageUrl="~/Image/Hoch.JPG" CausesValidation="false"
CommandName="Up" CommandArgument='<%# Container.DataItemIndex %>' Visible="True" />
<asp:ImageButton ID="ImageButton2" runat="Server" ImageUrl="~/Image/Runter.JPG" CausesValidation="false"
CommandName="Down" CommandArgument='<%# Container.DataItemIndex %>' Visible="True" />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
</Columns>
<RowStyle BackColor="#E5E5E5" />
<EditRowStyle BackColor="#A9A9A9" />
<SelectedRowStyle BackColor="#A9A9A9" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#FF8000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
by the way, it is possible to place somewhere a Row in Gridview? Suppose I have a group item and clicking on Add new and under the clicked row
will be added the new row
|
|
|
|
|
Using a css class
<style type="text/css" media="screen">
.hiddencol
{
display:none;
}
.visiblecol
{
display:block;
}
</style>
To hide / show the columns
<Columns>
<asp:CommandField HeaderText="Edit-Update" ShowEditButton="True" ItemStyle-CssClass="visiblecol"/>
<asp:ButtonField ButtonType="Link" CommandName="Save" ItemStyle-CssClass="hiddencol" />
<asp:BoundField DataField="SkillGroupID" Visible="false" ReadOnly="True" />
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:TextBox ID="Txt_Edit" Text='<%#Eval("SkillGroupName") %>' runat="server" Width="60px" ></asp:TextBox>
</asp:Panel>
<ItemStyle CssClass="hiddencol" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="Panel2" runat="server">
<asp:Label ID="Lbl_Edit" Text='<%#Eval("SkillGroupName") %>' runat="server" Width="60px" ></asp:Label>
</asp:Panel>
<ItemStyle CssClass="visiblecol" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="Server" ImageUrl="~/Image/Hoch.JPG" CausesValidation="false" CommandName="Up" CommandArgument='<%# Container.DataItemIndex %>' Visible="True" />
<asp:ImageButton ID="ImageButton2" runat="Server" ImageUrl="~/Image/Runter.JPG" CausesValidation="false" CommandName="Down" CommandArgument='<%# Container.DataItemIndex %>' Visible="True" />;
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
</Columns>
then in your RowCommand you can change the 'visiblecol' style by 'hiddencol' and 'hiddencol' by 'visiblecol' like I've posted before
|
|
|
|
|
Please can anyone provide solution to this?
Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:
Line 137: {
Line 138:
Line 139: lngCaseMasterIDAry[i] = Convert.ToDouble(dr["CaseMasterID"]);
Line 140: strCaseNoAry[i] = dr["CaseNo"].ToString();
Line 141: strCaseBrief[i] = dr["CaseBrief"].ToString();
Source File: e:\CDRV3WebVersion\CaseMaster.aspx.cs Line: 139
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
CaseMaster.btnView_Click(Object sender, EventArgs e) in e:\CDRV3WebVersion\CaseMaster.aspx.cs:139
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
|
|
|
|
|
may be the i is greater then the size of array.
|
|
|
|
|
i is initialsize to 0 and array size is set equal to record count?
|
|
|
|
|
Thanks a lot dear i was been initialized before and was not cleared.therefore it was throwing and exception?
Thanks to All.
|
|
|
|
|
Cheers!!
Brij
|
|
|
|
|
did you define array "lngCaseMasterIDAry" with required size?Debug it you'll get the problem. Cheers!!
Brij
|
|
|
|