|
|
yes, the object reference error comes as per your coding is you have multiple rows in the grid, But you have not mentioned in which row the textbox is presented. YOu can just see in your code itself.
//instead of this:
Dim txtname As TextBox = DirectCast(grdRow.FindControl("txtName"), TextBox)
//use this
Dim txtname As TextBox = DirectCast(grdRow.Rows[0].FindControl("txtName"), TextBox)
txtname.ReadOnly = False
//for this only the first row of the grid textbox will be readonly = false.
//if you want for all the rows then put for loop
for(i=0;i < grdRow.Rows.count;i++)
{
Dim txtname As TextBox = DirectCast(grdRow.Rows[i].FindControl("txtName"), TextBox)
txtname.ReadOnly = False
}
//I hope you understood now
|
|
|
|
|
|
its still giving me the same error..... .....plz help me
|
|
|
|
|
send me the code wat you are using now
|
|
|
|
|
Protected Sub chkSelect_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim chkTest As CheckBox = DirectCast(sender, CheckBox)
Dim grdRow As GridViewRow = DirectCast(chkTest.NamingContainer, GridViewRow)
Dim txtname As TextBox = DirectCast(grdRow.FindControl("txtName"), TextBox)
If chkTest.Checked Then
txtname.ReadOnly = False
txtname.ForeColor = System.Drawing.Color.Black
Else
txtname.ReadOnly = True
txtname.ForeColor = System.Drawing.Color.Blue
End If
End Sub
|
|
|
|
|
KhandelwalA wrote: Dim txtname As TextBox = DirectCast(grdRow.FindControl("txtName"), TextBox)
after clearly explaining, you havn't changed anything. You have to include for loop and include rows in the find control.
|
|
|
|
|
that i did..........but still giving error man........look at this
Protected Sub chkSelect_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim chkTest As CheckBox = DirectCast(sender, CheckBox)
Dim grdRow As GridViewRow = DirectCast(chkTest.NamingContainer, GridViewRow)
For i As Integer = 0 To GridView1.Rows.Count - 1
Dim txtname As TextBox = DirectCast(GridView1.Rows(i).FindControl("txtName"), TextBox)
txtname = Nothing
If chkTest.Checked Then
txtname.ReadOnly = False
txtname.ForeColor = System.Drawing.Color.Black
Else
txtname.ReadOnly = True
txtname.ForeColor = System.Drawing.Color.Blue
End If
Next
End Sub
|
|
|
|
|
KhandelwalA wrote: txtname = Nothing
remove this.
|
|
|
|
|
that i did............but still giving error
|
|
|
|
|
I have changed your code a bit.Try using it....N.B : have you checked the textbox name is txtName?It's case sensitive..check it.
Protected Sub chkSelect_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim chkTest As CheckBox = DirectCast(sender, CheckBox)
Dim fc As DataControlFieldCell=DorectCast(chkTest.Parent,DataControlFieldCell)
Dim grdRow As GridViewRow=DirectCast(fc.Parent,GridViewRow)
Dim txtname As TextBox = DirectCast(grdRow.FindControl("txtName"), TextBox)
If chkTest.Checked Then
txtname.ReadOnly = False
txtname.ForeColor = System.Drawing.Color.Black
Else
txtname.ReadOnly = True
txtname.ForeColor = System.Drawing.Color.Blue
End If
End Sub
CC26
|
|
|
|
|
CrazyCoder26 wrote: I have changed your code a bit.Try using it....N.B : have you checked the textbox name is txtName?It's case sensitive..check it.
i dont think changing name will make any difference.
|
|
|
|
|
Most probably you didn't see my code properly...I didn't ask to change name.I told to check whether the textbox name is correct.
For example....if the textbox name is txtName, then txtname won't work
CC26
|
|
|
|
|
Dear All,
Our requirement is a cab has assigned to Pick and Drop the employee for each and every shifts for the selective date. So, we need to show how much distance a cab has travelled, then we need to show that cab has been assigned for Pick/Drop for all the selective date.
As per my Procedure we can get the "Shift Date Time", "Cab No", "Pick/Drop" value, etc....
In Range chart I need to show the "Shift Time" in "X Axis" like "9 AM", "10 AM", "11 AM".....upto Next day "8 AM".
then In "Y Axis" I need to show "Shift Date Time" & "Cab No." which come from table.
In "Y Axis" i can not show the "Shift Date Time", So, I tried to show in "X Axis", but I can show only shift Date not time.
Actually I need to show the shift date in "Y Axis" only.
If any one have the solution, Please reply me.
Thanks in Advance.
Regards,
Jegan.K
9994388922
Jegan
|
|
|
|
|
I encountered this error in the web .config please help me out.
Could not load file or assembly 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Am encountering this problem in the web .config
thanks in anticipation.
|
|
|
|
|
What makes you believe you have this required file ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Flavia A wrote: Could not load file or assembly 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
So, its clearly says what is the problem.
|
|
|
|
|
So what should i do for it.because My others projects run successfully and nver give this error.How will i get the required file.
|
|
|
|
|
Add refernece of the DLL
himanshu
|
|
|
|
|
Flavia A wrote: How will i get the required file.
Add the Reference of that required DLL.
|
|
|
|
|
Hello EveryBody.
I am new in Nhibernate with Asp .Net.
MyFolder Structer is
in D Drive :
D:\online\OES
in this some folder like
OES.DAO---it is a Class libabrary
OnlineExam---It Is website in Asp .Net
and My solution File OES.sln
Tecnology used is VS2005,Nhibernate,Asp .Net,AJAX
I develope A Arcitectuer in which two layer .
One is website layer and one is my Class libarary whic name is OES.DAO.
OES.DAO CONTAION ALL BUSINESS logic.
OES.DAO CLASS LIABARY CONTAION SOME FOLDER
ONE OF THEM IS
1.dblayer: it contaion one class
which code is
Code:
using System;
using System.Collections;
using System.Web;
using NHibernate;
using NHibernate.Cfg;
using Iesi.Collections;
using OES.DAO.businessobjects;
using OES.DAO.util;
namespace OES.DAO.dblayer
{
/// <summary>
/// This is the main class for accessing the database via the NHibernate O/R mappings.
/// The middle tier should use this class for DB access!
///
/// The usage of this class is along the lines of:
/// 1. Call BeginDBWork() and use the session it returns for DP operations
/// 2. Call EndDBWork() - commits the transaction frees resources etc.
///
/// The above methods are to be called by the application at start/end of
/// processing a request. Individual ASP.NET pages are expected to use
/// GetCurrentSession() to work on their data!
///
/// </summary>
public class DBFacade
{
private const string SessionHTTPContextKey = "itexampractice-context_session";
private const string TransactionHTTPContextKey = "itexampractice-context_transaction";
private static readonly ISessionFactory sessionFactory;
private static readonly bool runningInMonoOnUnix;
private static readonly bool runningInMSDOTNET;
/// <summary>
/// Initialization method for the DB facade. Gor now it is a dummy since the static
/// initializer does the work
/// </summary>
public static void Init()
{
// ...
}
static DBFacade()
{
sessionFactory = new Configuration().Configure().BuildSessionFactory();
Log.Info("DB Facade being initilaized, Platform: " + OSInfo.PlatformName);
runningInMSDOTNET = OSInfo.PlatformIsWindows;
runningInMonoOnUnix = OSInfo.PlatformIsASortOfUnix;
if (runningInMonoOnUnix)
{
// TODO: Maybe special init code .. if necessary
};
}
/// <summary>
/// Opens a new session for woring with the database. At the same time starts
/// a new transaction. The session and transaction are saved under the server's
/// HTTP context. The session object is returned for subsequent operations
/// </summary>
public static ISession BeginDBWork()
{
HttpContext context = HttpContext.Current;
ISession currentSession = context.Items[SessionHTTPContextKey] as ISession;
ITransaction currentTransaction = context.Items[TransactionHTTPContextKey] as ITransaction;
if ((currentSession == null) && (currentTransaction == null))
{
currentSession = sessionFactory.OpenSession();
context.Items[SessionHTTPContextKey] = currentSession;
currentTransaction = currentSession.BeginTransaction();
context.Items[TransactionHTTPContextKey] = currentTransaction;
} else
{
// TODO: Close sesion and transaction
// No current session
throw new SystemException(
"It seems someone is trying to open an NHibernate session, although " +
"one is already open!");
}
return currentSession;
}
/// <summary>
/// Returns the previosly opened session. Throws exception if it is not open!
/// </summary>
public static ISession GetCurrentSession()
{
HttpContext context = HttpContext.Current;
ISession currentSession = context.Items[SessionHTTPContextKey] as ISession;
if (currentSession == null)
{
// No current session
throw new SystemException(
"It seems someone is trying to get a NHibernate session, although " +
"one is NOT currently open!");
}
return currentSession;
}
/// <summary>
/// Starts a new transaction within the same session. May be used when we have
/// processing spanning several transactions.
/// For convenience returns the session.
/// </summary>
public static ISession StartNewTransaction()
{
HttpContext context = HttpContext.Current;
ISession currentSession = context.Items[SessionHTTPContextKey] as ISession;
ITransaction currentTransaction = context.Items[TransactionHTTPContextKey] as ITransaction;
if ((currentSession == null) || (currentTransaction == null))
{
// No current session
throw new SystemException("Starting new transaction but no session exists!");
}
currentSession.Flush();
// TODO: This is a workaround for problems with Mono and ADO.NET
// transactions. The bug is expected to be fixed in Mono in early
// 2008!
try
{
currentTransaction.Commit();
} catch (Exception e)
{
if ((!(e is NullReferenceException)) || runningInMSDOTNET)
{
throw e;
} else // NullRef in Mono
{
Log.Warning("DBFacade: Ignoring NullReferenceException - " +
"Workround for a Mono bug (versions prior to 1.2.6) " +
"with ADO.NET transactions!");
}
}
// Start a new transaction here
currentTransaction = currentSession.BeginTransaction();
context.Items[TransactionHTTPContextKey] = currentTransaction;
return currentSession;
}
/// <summary>
/// Ends a previously opened session. Commits the current transactions and
/// closes the session.
/// </summary>
public static void EndDBWork()
{
HttpContext context = HttpContext.Current;
ISession currentSession = context.Items[SessionHTTPContextKey] as ISession;
ITransaction currentTransaction = context.Items[TransactionHTTPContextKey] as ITransaction;
if ((currentSession == null) || (currentTransaction == null))
{
// No current session
throw new SystemException("Ending DB work but no session exists!");
}
try
{
currentSession.Flush();
// TODO: This is a workaround for problems with Mono and ADO.NET
// transactions. The bug is expected to be fixed in Mono in early
// 2008!
try
{
currentTransaction.Commit();
} catch (Exception e)
{
if ((!(e is NullReferenceException)) || runningInMSDOTNET)
{
throw e;
} else // NullRef in Mono
{
Log.Warning("DBFacade: Ignoring NullReferenceException - " +
"Workround for a Mono bug (versions prior to 1.2.6) " +
"with ADO.NET transactions!");
}
}
} finally
{
context.Items.Remove(SessionHTTPContextKey);
context.Items.Remove(TransactionHTTPContextKey);
// TODO: Close the session in any case - to start clean!
currentSession.Close();
};
}
/// <summary>
/// Releases all NHibernate resources for DB oprations. To be called at the
/// exit of the Web application.
/// </summary>
public static void CloseSessionFactory()
{
if (sessionFactory != null)
{
sessionFactory.Close();
}
}
}
}
Here I Got Error sessionFactory = new Configuration().Configure().BuildSessionFactory();
2.Thesecond FOLDER in OES.DAO IS businessobjects
WHICH CONTAION the all classes which map the database Tables.
Now In My Fisrt Layer whic name is OnlineExam [It is website] and My Solution File name is OES.
The Mapping hb.xml Files in dbmappings Folderls which map Database tables one of then is
AnswerToMCQuestion.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace=" OES.DAO.businessobjects" assembly="OES.DAO" >
<class name="AnswerToMCQuestion" table="tAnswerToMCQuestion">
<id name="Id">
<column name="cId"/>
<generator class="uuid.hex" />
</id>
<property name="CreationDateTicks">
<column name="cCreationDateTicks"/>
</property>
<property name="IsRightAsInt">
<column name="cIsRight"/>
</property>
<property name="AnswerText">
<column name="cAnswerText"/>
</property>
<property name="NumInOrder">
<column name="cNumInOrder"/>
</property>
<many-to-one
name="Question"
class="MultipleChoiceExamQuestion"
column="cQuestionId"
not-null="true"/>
</class>
</hibernate-mapping>
Now The main Thing is Web.Config file setting where I got Error bz i dont know how to Map these .HBM.XML File here and how i give The Path bz My Business logic table which map the database tables in OES.DAO layesr .
Code:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory >
<!-- SECTION TO BE CHANGED DEPENDING ON DATABASE AND RUNTIME ENVIRONMENT -->
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Data Source=.;Initial Catalog=sd;User ID=sa;Password=sa;</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="show_sql">false</property>
[b]
<mapping resource="../config/common/dbmappings/User.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/QuestionComment.hbm.xml" assembly="OES"/>
<mapping resource="../config/common/dbmappings/QuestionRating.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/TestExamination.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/Exam.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/ExamSection.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/Vote.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/VoteByLink.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/ExamQuestion.hbm.xml" assembly="OES" />
<mapping resource="../config/common/dbmappings/AnswerToMCQuestion.hbm.xml" assembly="OES" />[/b]
</session-factory>
</hibernate-configuration>
<system.web>
<!--<trust level="Medium"/>-->
<httpRuntime executionTimeout="1000" maxRequestLength="250000"/>
<!--<sessionState mode="InProc" cookieless="false" timeout="180"/>-->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
<globalization culture="en-us" uiCulture="en"/>
<compilation debug="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<!--<authentication mode="Forms">
<forms loginUrl="Login.aspx"/>
</authentication>-->
<authorization>
<allow users="*"/>
</authorization>
<customErrors mode="Off">
</customErrors>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
</system.web>
<!--<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>-->
</configuration>
In Mapping Tag i dont understand How I give The Path .
which Assempbly path I give .How I give the .HBM.XML File Path .
Please Help me All professionls .I am New In Nhibernate
I wam waiting For Replies.
Rakesh Gaur
mkclrakesh@gmail.com
|
|
|
|
|
Some security error showing when i am trying to upload the image. it is working fine in the source code(Localy), but after uploading the page and trying getting the following error. Error is showing in the System.Drawing.Image Part.
Error Details as follows
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
Line 68: int thumbWidth = 0;
Line 69:
Line 70: System.Drawing.Image image = System.Drawing.Image.FromFile(cmdUpload.PostedFile.FileName);
Line 71: if (image.Width > 500)
Line 72: {
Source Code as follows
int thumbWidth = 0;
System.Drawing.Image image = System.Drawing.Image.FromFile(cmdUpload.PostedFile.FileName);
if (image.Width > 500)
{
thumbWidth = 500;
}
else
{
thumbWidth = image.Width;
}
int srcWidth = image.Width;
int srcHeight = image.Height;
Decimal sizeRatio = ((Decimal)srcHeight / srcWidth);
int thumbHeight = Decimal.ToInt32(sizeRatio * thumbWidth);
Bitmap bmp = new Bitmap(thumbWidth, thumbHeight);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, thumbWidth, thumbHeight);
gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel);
Font font = new Font("Verdana", 14, FontStyle.Bold, GraphicsUnit.Pixel);
Color color = Color.FromArgb(100, 0, 0, 0);
Point pt = new Point(2, 3);
SolidBrush sbrush = new SolidBrush(color);
gr.DrawString("www.Test.com", font, sbrush, pt);
System.IO.MemoryStream stream = new System.IO.MemoryStream();
bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
stream.Position = 0;
byte[] picture = new byte[stream.Length];
stream.Read(picture, 0, (int)stream.Length); // < - - Saving to SQL Server - - >
string result = string.Empty;
result = DatabaseLayer.Wishes.InsertWishes(category, Convert.ToInt32(ddNumber.SelectedValue), ddCh.SelectedIndex, txtDate.Text, picture, txtName.Text, txtHouseName.Text, txtEmail.Text, txtComment.Text);
ddNumber.SelectedIndex = 0;
ddCh.SelectedIndex = 0;
txtDate.Text = "";
txtName.Text = "";
txtHouseName.Text = "";
txtEmail.Text = "";
txtComment.Text = "";
Label1.Text = "";
bmp.Dispose();
image.Dispose();
Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "msgbox", "alert('" + result + "');", true);
}
|
|
|
|
|
This looks messy. VERY messy.
Why don't you build the image from a memory stream constructed from the bytes that you can access from the upload control ? As for the rest, I'm not sure what to suggest.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Can we create a new image with the uploaded image using with memory stream. i want to create a new image, with new size and add watermark in this image. if we can do these things with memory stream can i get some ideas(sample codes)
|
|
|
|
|
MemoryStream ms = new MemoryStream(upload.Bytes); // Whatever it is, intellisense will tell you
Bitmap bm = Bitmap.FromStream(ms);
That's it. You have a bitmap and you can do what you like to it.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|