Hi, I am having some problem with the layout of the ASP page. Here is what happens. I have 2 data grid inside a page which makes the page to be longer and therefore automatically a scrollbar will appear on the side of the browser for user to scroll down. But what I set in the code is, only one datagrid will show at one time base on some criteria. So on the user side, it is appears not longer than the window size and therefore should not have any scroll bar at the side of the window. The problem is, the 2nd datagrid is visible=false but the browser still detect the 2nd datagrid which tells the browser the web page is much longer than the window and therefore the scrollbar appear on the side. What I want to know is, is there any way to tell the browser not to take into account those invincible components like the 2nd datagrid and so do not give a scrollbar at the side of the window? Thanks in advance.
J Liang
Posts
-
Scrolling problem with invincible data grid -
How to print without user interactionOh, the reason that the user needs to upload the pdf file to the server is because it needs to be attach with banners as header and footer of the pdf file. Meaning, the server will re-alter the content of the pdf file with extra information. I actually found this link which will print the pdf without prompting user to click print. http://www.planetpdf.com/forumarchive/110829.asp[^] It seems working though, still in the process of testing it.
-
How to print without user interactionHi, I have a web page which allow user to upload files to the server over the Internet and print it out on the local printer. What I did now is after the user upload the pdf file, when click 'process', it will open the Save As dialog box for user to download and save the file on to the local computer for printing. What I wish to do is when click 'process', I want it to directly start printing to the local printer without any user interaction. What I have thought of till now is, to download from the backgroud to the user's computer and trigger the printing on the computer but I just don't know how can I do that. Need you guys to shed some light for me, thanks.
-
Back and Next buttonHi, Let me go straight to the point. I am doing a something like a wizard we use to setup some programs or system. I have 5 pages which all 5 pages is link together with 'Back' and 'Next' button. It was working fine until I tried the Back button and click Next again. I find it some what difficult to detect that the user clicked back and therefore when the user click next again, I suppose to do 'Update' and not 'Add' and also sometimes what the user typed in the form is not there any more. I'd tried a few solutions such as putting in checks whether the user already entered data by taking the primary key after inserting the data and put into a invincible label, so when the user press back, the system can check the label whether there is any value in it. I find it a bit tedious to do so, so I decided to come here to seek some expert advice on the best practice to do this - How to Add and Update respectively and keep everything on the page no matter the user click Back and Next how many times. This is what I did on the Back button
this.btnBack.Attributes.Add("onclick", "javascript:history.back();return false;");
-
Convert image to binary and back to imageI think i realized there is a place where could cause all these. I uses a stored procedure to get the binary data out but I'd declare in my coding as byte[]. So it gives me a problem when I do
SqlParameter objParam2;
objParam2 = myCommand.Parameters.Add("@cpyLogo", SqlDbType.Binary, 5000);
objParam2.Direction = ParameterDirection.Output;
myCommand.ExecuteNonQuery();
if (objParam2.Value == DBNull.Value)
{
cpyLogo = null;
}
else
{
cpyLogo = Convert.ToByte(objParam2.Value); <--Note it is not converting to byte[]
}So I found in the internet where they uses this function to convert to byte array
public static byte[] ConvertStringToByteArray(string stringToConvert)
{
return (new UnicodeEncoding()).GetBytes(stringToConvert);
}And I changed my code to
if (objParam2.Value == DBNull.Value)
{
cpyLogo = null;
}
else
{
cpyLogo = ConvertStringToByteArray(objParam2.Value.ToString());
}Later I realized I'd read some where that I should not threat binary data as string (objParam2.Value.ToString()), could this be the problem? Or there is another way to change my objParam2.Value to byte array? I think now what I need to do is to find out how to convert binary to byte array first.
modified on Thursday, June 12, 2008 5:21 AM
-
Convert image to binary and back to imageAfter some checking, I tried to do a select statement in Mssql and found out that there are values in the image column of my table (a bunch of alpha numeric) I'd tried checking the strCpyLogo.Length and it only show me 26. Now I really lost, not really sure where should I go now. The piece of code you show me earlier
using (MemoryStream stream = new MemoryStream(strCpyLogo))
{
using (System.Drawing.Image image = System.Drawing.Image.FromStream(stream))
{} }
Is this suppose to help me create a physical jpg file and allow my tag to point to that jpg file? I saw a few example which is uses similar approach as you shown me here.
-
Convert image to binary and back to imageI got a error message when I run the code Exception Details: System.ArgumentException: Parameter is not valid. on this line using (System.Drawing.Image image = System.Drawing.Image.FromStream(stream)) I am doing this in my code
byte[] strCpyLogo;
Response.ContentType = "image/jpeg";
using (MemoryStream stream = new MemoryStream(strCpyLogo)) { using (System.Drawing.Image image = System.Drawing.Image.FromStream(stream)) { // Use the image variable here } }
Where strCpyLogo was a binary data from the database
-
Convert image to binary and back to imageI'm not really understand this line
// Use the image variable here
Do you mean to assign System.Drawing.Image image into my
This is what I did from your code given
using (MemoryStream stream = new MemoryStream(strCpyLogo))
{
using (System.Drawing.Image image = System.Drawing.Image.FromStream(stream))
{
// Use the image variable here} }
Where strCpyLogo is in type byte which I retrieve from my database. In the database, strCpyLogo shows which i assumed it had already saved into the database. I'd tried this.imgLogo but could not find any command that seems logic to me to assign System.Drawing.Image image to it.
-
Convert image to binary and back to imageThanks, it works now. I got this 25521625522401674707370011107207200255225310069120105102007373420800070151201000098000161209000108000 491202700011800050120.... Is this what I suppose to get? The numbers do turn different as I upload different pictures. Now I know there is a lot of solutions out there to turn the above binary back to an image file but I just could not find one working, is there any code which any of you are using that is working? Can shade some light for me? Thanks.
-
Convert image to binary and back to imageHi, Been checking around the net for the above subject and found a lot of solutions but seems not able to work for me. This is my situation, I am using a textbox with type='file' to get the image from local. Then when user clicks a button, it suppose to convert the picture user chose into binary data and save it into the MSSQL database which in the column declared as binary(5000). When the user load the page again, I want the system to get the binary data from the database, covert it back to the original format, and place it in the tag. Here is the code I'm using but I suspect something is just not right.
byte[] imagecontent = null;
if (fudLogo.Value != "")
{
//If got logo need upload, change it to binary format
string strfile = System.IO.Path.GetFileName(fudLogo.PostedFile.FileName);
string strexten = System.IO.Path.GetExtension(fudLogo.PostedFile.FileName);
if (strexten.Equals(".jpg") || strexten.Equals(".JPG") || strexten.Equals(".gif") || strexten.Equals(".GIF") || strfile.Equals(""))
{
System.IO.Stream stream;
Int64 imagesize;
int imgstatus;
imagesize = fudLogo.PostedFile.ContentLength;
stream = fudLogo.PostedFile.InputStream;
imagecontent = new byte[stream.Length];
}
}
else
{
imagecontent = this.strCpyLogo;
}//Update to database if (this.staff.UpdateCompany(this.txtCompanyName.Text, imagecontent, this.txtAddress1.Text, this.txtAddress2.Text, this.txtAddress3.Text, this.txtPostCode.Text, this.txtState.Text, this.txtCountry.Text, Application\["compid"\].ToString()) == true) { Response.Redirect("E09-WorkingDayM.aspx?compid=" + Application\["compid"\].ToString() + "&empid=" + this.strEmpId + "&resetting=1"); } else { this.lblErrMsg.Text = "Could not update company info at this moment."; }
I tried to view the raw binary data just to check whether it is right by using below code
string aa = "";
for (int i = 0; i < imagecontent.Length - 1; i++)
{
aa += imagecontent[i].ToString();
} -
Include master page at run timeOh ok, now I know that I can't include the master page during run time. Thanks for saving from turning in circle again and again. :)
-
Include master page at run timeI think I slowly get what you mean. The content page is where all my textboxes, buttons are. This is what I did, in my aspx page's html:
But I got the error when change it back to design view Content control can only be use in a content page I guess I still missing some point you trying to tell me?
-
Include master page at run timeYa, I read this about asp:content tag, but what I don't understand is I could not find asp:content tag in any of my page. Sorry this might sound silly, where should this asp:content tag suppose to be in? .master or .aspx?
-
Include master page at run timeHere's the aspx page
]]>
]]>
E06-Employee font-size="Small"> DataTextField="empName" HeaderText="Name" NavigateUrl="~/E0601-NewEmployee.aspx?empid={0}&update=1&compid={1}&option=employee" SortExpression="empName" Target="\_blank" />
-
Include master page at run timeHi, I am currently wanted to include my master page into a page that do not include master page initially. I'd tried this code, protected override void OnPreInit(EventArgs e) { this.MasterPageFile = "~/Main.master"; base.OnPreInit(e); } but run into this error Content controls have to be top-level controls in a content page or a nested master page that references a master page What I am trying to do is to include a master page into the web page during run time as I only wanted the master page to be included when certain criteria is met. I'd look around the net but still don't get it what went wrong, hope I can get some idea from here. Thanks.
-
Ajax ModalPopUpControl [modified]Hi, I am having this problem with this ModalPopUpControl from Ajax. It did pop up as it meant to be but I want it to do something more. Basically, there are two Panel that will pop up, lets name it Panel1 and Panel2. Panel2 will appear after Panel1 if some conditions are met, if not, it shoudl not appear. So in Panel1, I put a button Button1, hoping I can put in some condition under this button to call out Panel2. I want the protected void Button1_Click(object sender, EventArgs e) to fire but it seems nothing happens, it just show me Panel2 straight without checking the condition. So I wanted to know how can I set some conditions to stop the ModalPopUpControl to proceed if the conditions are not met. Or another way is how I can invoke a button click from javascript so that it will run the protected void Button1_Click(object sender, EventArgs e) for me since the ModalPopUpControl has a OnOkScript which will call a javascript function in the page. Thanks in advance. :)
modified on Tuesday, May 20, 2008 5:28 AM
-
ASP.NET Editable Drop Down ListOk, I did saw those two ajax component, thanks for the confirmation that they can do what I'd been looking for, I shall try it. But the only thing is I not sure how to link the Autocomplete extender to a SqlDataSource, I dragged and drop the SqlDataSource but not sure the coding on how I link the Autocomplete to this SqlDataSource of mine. I read something about WebServices but not sure how I can use that to link the Autocomplete Extender with the SqlDataSource.
-
ASP.NET Editable Drop Down ListHi, Currently I am trying to create a drop down list which user could type in his/her desired words and the drop down list will filter accordingly and list down for the user. The item in the list is from the SqlDataSource which I use a stored procedure to call out the list of item to be populate in the drop down list. For example, the user type 'a', the words aeroplane, apple will be listed out but not ball, boy and when the user type 'ae', the word aeroplane will appear and not apple. I found some solutions but it is not working, maybe some of you had already done this, so I would really appreciate that you could share your experience with me. By the way, I am using C# ASP.NET. Thanks
-
AJAX UpdatePanel not passing out the valueHey, Thanks man, it works, it actually pass the value out. But I did some changes to it. I put the txtTask into UpdatePanel2 and add AsyncPostBack for ddTask in UpdatePanel2, so when SelectIndexChanged trigger for ddTask, it update txtTask in UpdatePanel2, now my GridView1 in UpdatePanel2 can refer to txtTask with no problem. :) J Liang
-
AJAX UpdatePanel not passing out the valueHi, I'm having some problem with AJAX, hope to get some work around from you guys here. I have 2 drop down box and 1 GridView - ddProject, ddTask, GridView1 ddTask is in the UpdatePanel1 GridView1 is in the UpdatePanel2 OnSelectedIndexChanged on ddProject will fill up ddTask which works fine. My GridView1 will present the data base on the value selected in ddTask, the problem is the where clause in GridView1's Control does not have the ddTask for me to choose. I put a textbox outside all UpdatePanel and name it txtTask so that GridView1 can refer to this for displaying data, and do a OnSelectedIndexChanged on ddTask but txtTask is not filled with anything when I select from ddTask. The question is, how do I bring out data from UpdatePanel to controls that are outside the UpdatePanel. Thanks in advance. J Liang