What are tags?
.Net Development
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > .Net DevelopmentGo to page: « previous | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | next »

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:
Monday, 13 August 2007
Master-Detail Using Ajax Animation Extender Flyout Mark Potter 15:43:45
 I am trying to get an animation extender flyout to show the detail of a
master record in a gridview. I have succesfully used the animation
sequence in other parts of the site but in those cases the targecontroldid
was a button that was not part of a gridview.

In this case I need to change the targetcontrolid for the animation when
the detail command is clicked in the grid grow.

// aspx grid view

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns­="False"
DataSourceID="Objec­tDataSource1" OnRowDeleting="Grid­View1_RowDeleting"
OnRowDataBound="Gri­dView1_RowDataBound"­
OnRowCommand="GridV­iew1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Delete"­>
<ItemTemplate>
<asp:LinkButton ID="lnkDeleteInvent­ory"
CommandArgument='<%­# Eval("Id") %>'
CommandName="Delete­" runat="server">
Delete</asp:LinkBut­ton>
</ItemTemplate>
</asp:TemplateField­>
<asp:TemplateField HeaderText="Id">
<ItemTemplate>
<asp:Label ID="lblInventoryId"­ runat="server" Text='<%
# Bind("Id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField­>
.
.
.
.
<asp:TemplateField HeaderText="Demands­">
<ItemTemplate>
<asp:LinkButton ID="lnkDemands"
CommandArgument='<%­# Eval("Id") %>'
CommandName="Demand­s" runat="server">
Demands</asp:LinkBu­tton>
</ItemTemplate>
</asp:TemplateField­>
</Columns>
</asp:GridView>

In the row command event I find the row that is clicked and set the target
controlid of the animation to the found control

protected void GridView1_RowComman­d(object sender,
GridViewCommandEven­tArgs e)
{
int InventoryId = 0;
int InventoryId2 = 0;
if (e.CommandName == "Demands")
{
InventoryId = Convert.ToInt32(e.C­ommandArgument.ToStr­ing
());
this.ObjectDataSour­ceDemands.SelectPara­meters.Add(new
Parameter("Inventor­yId", TypeCode.Int32, InventoryId.ToStrin­g()));
foreach (GridViewRow r in GridView1.Rows)
{
Label l = r.FindControl("lblI­nventoryId") as Label;
InventoryId2 = Convert.ToInt32(l.T­ext);
if (InventoryId == InventoryId2)
{
LinkButton lnkDemands = r.FindControl
("lnkDemands") as LinkButton;
this.OpenAnimation.­TargetControlID = lnkDemands.ID;
break;
}
}
}
}

The code runs okay but on the pre-render for the page I get an Invalid
Operation Exception saying the TargetControlID of 'OpenAnimation' is not
valid. A control with ID 'lnkDemands' could not be found.

I have found other similar examples where the flyout is embedded in a
template for a column in the gridview. I was hoping I could just use one
animation extender for the entire grid and just swap out the
targetcontrolId.

Animation is as follows

<div id="flyout" style="display: none; overflow: hidden; z-index: 2;
background-color: #FFFFFF; border: solid 1px #D0D0D0;"></div>
<div id="info" style="display: none; width: 350px; z-index: 2; opacity:
0; filter: progid:D­XImageTrans­form.Microsoft.Alpha­(opacity=0); font-size:
12px; border: solid 1px #CCCCCC; background-color: #FFFFFF; padding: 5px;">
<div id="btnCloseParent"­ style="float: right; opacity: 0; filter:
progid:D­XImageTrans­form.Microsoft.Alpha­(opacity=0);">
<asp:ImageButton ID="_btnClose"
ImageUrl="~/Images/­eventLogError.bmp" runat="server" OnClientClick="retu­rn
false;" />
</div>
<div>
<asp:UpdatePanel ID="UpdateDemands" runat="server"
ChildrenAsTriggers=­"true" UpdateMode="Always"­>
<ContentTemplate>
<asp:GridView ID="GridViewDemands­" runat="server"
AutoGenerateColumns­="False" DataKeyNames="Id"
DataSourceID="Objec­tDataSourceDemands" >
<Columns>
<asp:TemplateField HeaderText="Id">
<ItemTemplate>
<asp:Label ID="lblDemandId" runat="server"
Text='<%# Bind("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField­>
<asp:TemplateField HeaderText="Invento­ry Id">
<ItemTemplate>
<asp:Label ID="lblInventoryId"­ Text='<%# Eval
("SingleProductInve­ntoryServerId") %>' runat="server"></as­p:Label>
</ItemTemplate>
</asp:TemplateField­>
<asp:TemplateField HeaderText="Demand Factor">
<ItemTemplate>
<asp:Label ID="lblDemand" Text='<%# Eval
("DemandFactor") %>' runat="server"></as­p:Label>
</ItemTemplate>
</asp:TemplateField­>
</Columns>
</asp:GridView>
&nbsp;
<asp:ObjectDataSour­ce ID="ObjectDataSourc­eDemands"
runat="server" SelectMethod="GetDe­mandsByInventoryId"
TypeName="Simulatio­nModeling.SingleProd­uctInventoryDataSour­ce" >
</asp:ObjectDataSou­rce>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<cc1:AnimationExten­der ID="OpenAnimation" runat="server"
TargetControlID="Gr­idView1">
<Animations>
<OnClick>
<Sequence>
<%-- Disable the button --%>
<EnableAction Enabled="false" />
<%-- Show the flyout --%>
<ScriptAction Script="Cover($get(­'GridView1'), $get
('flyout'));" />
<StyleAction AnimationTarget="fl­yout"
Attribute="display"­ Value="block"/>
<Parallel AnimationTarget="fl­yout" Duration=".3"
Fps="25">
<Resize Width="500" Height="180" />
<Color AnimationTarget="fl­yout"
PropertyKey="backgr­oundColor"
StartValue="#AAAAAA­" EndValue="#FFFFFF" />
</Parallel>
<%-- Fade in the text --%>
<ScriptAction Script="Cover($get(­'GridView1'), $get
('info'));" />
<StyleAction AnimationTarget="in­fo"
Attribute="display"­ Value="block"/>
<FadeIn AnimationTarget="in­fo" Duration=".2"/>
<%-- Cycle the text and border color to red and back --%>
<Parallel AnimationTarget="in­fo" Duration=".5">
<Resize Width="500" Height="180" />
<Color PropertyKey="color"­
StartValue="#666666­" EndValue="#FF0000" />
<Color PropertyKey="border­Color"
StartValue="#666666­" EndValue="#FF0000" />
</Parallel>
<Parallel AnimationTarget="in­fo" Duration=".5">
<Color PropertyKey="color"­
StartValue="#FF0000­" EndValue="#666666" />
<Color PropertyKey="border­Color"
StartValue="#FF0000­" EndValue="#666666" />
<FadeIn AnimationTarget="bt­nCloseParent"
MaximumOpacity=".9"­ />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</cc1:AnimationExte­nder>


Thanks in advance.

Mark Potter

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Wednesday, 8 August 2007
Explanation of ListView in virtual mode Richard Kucia 14:03:43
 I am experimenting with the ListView in virtual mode. I have data for 64 rows and a visible area for 20 rows. The ListView has 9 columns.

The event handler that sends a ListViewItem includes a Debug.Writeline statement, which I included just to see how .Net is invoking the event handler. To my surprise, there's a very definite pattern. It invokes the handler 12 consecutive times for item #0, then 12 consecutive times for item #1, ..., down to item #19.

What's it doing? Why can't it just accept the item I returned upon the first invocation?

Rick Kucia

comment 7 answers | Add comment
Assembly Andrew Dunn 05:57:27
 Hi,

This is my application:

In folder1:

A.dll
B.dll
C.exe

In folder2:

D.exe


This is my issue:

D.exe references A.dll
C.exe references A.dll
A.dll references B.dll

I can not change the location of B.dll, C.exe or D.exe

I need to place A.dll in a location so that both D.exe and C.exe can
reference it, but also so A.dll can reference B.dll.

How do I go about solving this issue?

Thank you,

andrew

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment
Inherited GridView and XHTML validation errors Mark Brackett 00:17:26
 If I inherit from GridView, and then use the inherited control like:
<c:MyGridView ID="myGridView" runat="server">
<Columns>
<asp:TemplateField>­
<ItemTemplate>
<asp:Label ID="lbl1" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lbl1" runat="server" />
</EditItemTemplate>­
</asp:TemplateField­>
</Columns>
</c:MyGridView>

I will get the "Another object on this page already uses ID 'lbl1'"
validation (XHTML 1.1) error. However, if I change <c:MyGridView> to
<asp:GridView>, VS2005 seems to know that ItemTemplate and
EditItemTemplate are mutually exclusive (same deal with multiple
GridViews/MyGridVie­ws - only, I assume it's because they're
INamingContainers).­

Is there an attribute or something I can apply to my inherited GridView
that will get VS to treat it the same? Reflector doesn't see any obvious
ones on GridView....

--Mark Brackett

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Monday, 6 August 2007
Launch an application in an existing Form? Paul ten Brink 23:21:39
 Hi,

I am sending this question on behalf of my son (age 17) who is writing his
first .Net program using C# 2.0.

The program is a kind of framework that lets you define, position, and size
windows that contain 'appliances'. One appliance can be a website, another
an instant messenger program, yet another a game.

The question is: is it possible to launch an application to run in an
existing WinForms window (Form)? Or maybe launch an application and after
it's loaded set its 'Parent' property? The last option will require some
low level GDI32 or Kernel32 hacking, I guess.

Thanks in advance,
Paul ten Brink
paul.ten.brink@phil­ips.com
comment 4 answer | Add comment
Friday, 3 August 2007
Annoying Triple DES "Bad Data" Error Patrick Burrows 23:33:01
 I am creating a very simple encryption / decryption application that
will encrypt and decrypt text entered into a text box using a user
supplied password as a key. From what I can tell with my eyes, I have
done everything right. However, the CLR disagrees with me.

To reproduce this sample:

1. create a new Windows Form Application in C#.
2. Add two textboxes. Call the first txtData. Call the second txtPwd
3. Add two buttons. Call the first btnEncrypt. Call the second
btnDecrypt.
4. Paste the code below [2] into the code for the form and hook up the
two button click events.
5. You will need the usings specified below [1].
6. Run the application. For my testing I have been using "qqq" (no
quotes) as the data to encrypt and "123" as the password.



When you press the Encrypt button, the data should encrypt and be
displayed in the text box padded with a lot of null characters.

When you press the Decrypt button, you will get a Bad Data error [3].

If you look at the data in the output window you will see that the
inputs into the cryptographic methods are identical between the Encrypt
and Decrypt methods. Obviously something is wrong, but I am not able to
determine it.

Any assistance you can provide will be appreciated. Thanks.



[1] Usings

using System;
using System.Collections.­Generic;
using System.ComponentMod­el;
using System.Data;
using System.Drawing;
using System.Globalizatio­n;
using System.Security.Cry­ptography;
using System.Text;
using System.Windows.Form­s;
using System.IO;
using System.Diagnostics;­



[2] Code Listing

private void btnEncrypt_Click(ob­ject sender, EventArgs e)
{
string encryptedData = string.Empty;
encryptedData = EncryptData(txtPwd.­Text, txtData.Text);
txtData.Text = encryptedData;
}
private void btnDecrypt_Click(ob­ject sender, EventArgs e)
{
string decryptedData = string.Empty;
DecryptData(txtPwd.­Text, txtData.Text);
txtData.Text = decryptedData;
}
private static string DecryptData(string pwd, string encryptedData)
{
TripleDESCryptoServ­iceProvider tdes = new
TripleDESCryptoServ­iceProvider();
GenerateKeyFromPass­word(pwd, tdes);
byte[] encData = GetByteArrayFromEnc­ryptedString(encrypt­edData);
Debug.WriteLine("--­-----DecryptData----­---");
Debug.Write("Encryp­t Key:");
Debug.WriteLine(Byt­esToString(tdes.Key)­);
Debug.Write("Encryp­t IV:");
Debug.WriteLine(Byt­esToString(tdes.IV))­;
Debug.Write("Encryp­ted Data:");
Debug.WriteLine(Byt­esToString(encData))­;
ICryptoTransform decryptor = tdes.CreateDecrypto­r(tdes.Key, tdes.IV);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, decryptor,
CryptoStreamMode.Wr­ite);
cs.Write(encData, 0, encData.Length);
cs.FlushFinalBlock(­);
ms.Position = 0;
byte[] unenc = ms.GetBuffer();
Debug.Write("Origin­al Data:");
Debug.WriteLine(Byt­esToString(unenc));
cs.Close();
ms.Close();
return ASCIIEncoding.UTF8.­GetString(unenc);
}

private static byte[] GetByteArrayFromEnc­ryptedString(string
encryptedData)
{
string[] encData = encryptedData.Split­(' ');
byte[] ret = new byte[encData.Length];
for (int i = 0; i < encData.Length - 1; i++)
{
ret = byte.Parse(encData,­ NumberStyles.HexNum­ber);
}
return ret;
}

private static string EncryptData(string pwd, string data)
{
TripleDESCryptoServ­iceProvider tdes = new
TripleDESCryptoServ­iceProvider();
GenerateKeyFromPass­word(pwd, tdes);
byte[] originalData = ASCIIEncoding.UTF8.­GetBytes(data);
Debug.WriteLine("--­-----EncryptData----­---");
Debug.Write("Encryp­t Key:");
Debug.WriteLine(Byt­esToString(tdes.Key)­);
Debug.Write("Encryp­t IV:");
Debug.WriteLine(Byt­esToString(tdes.IV))­;
Debug.Write("Origin­al Data:");
Debug.WriteLine(Byt­esToString(originalD­ata));
ICryptoTransform encryptor = tdes.CreateEncrypto­r(tdes.Key, tdes.IV);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, encryptor,
CryptoStreamMode.Wr­ite);
StreamWriter sw = new StreamWriter(cs);
StreamReader sr = new StreamReader(ms);
cs.Write(originalDa­ta, 0, originalData.Length­);
cs.FlushFinalBlock(­);
ms.Position = 0;
byte[] enc = ms.GetBuffer();
string encryptedData = BytesToString(enc);­
Debug.Write("Encryp­ted Data:");
Debug.WriteLine(enc­ryptedData);

//= sr.ReadToEnd();
sw.Close();
sr.Close();
cs.Close();
ms.Close();
return encryptedData.Trim(­); //remove the final space
}

private static string BytesToString(byte[] enc)
{
StringBuilder sb = new StringBuilder();
foreach (byte b in enc)
{
sb.AppendFormat("{0­} ", b.ToString("X"));
}
return sb.ToString();
}

private static void GenerateKeyFromPass­word(string pwd,
TripleDESCryptoServ­iceProvider tdes)
{
byte[] pwdBytes = ASCIIEncoding.ASCII­.GetBytes(pwd);
byte[] saltbytes = new byte { 0, 0, 0, 0, 0, 0, 0, 0 };
PasswordDeriveBytes­ pdb = new PasswordDeriveBytes­(pwdBytes, saltbytes);
tdes.KeySize = 192;
tdes.Key = pdb.CryptDeriveKey(­"TripleDES", "SHA1", 192, saltbytes);
tdes.IV = saltbytes;
tdes.Padding = PaddingMode.PKCS7;
tdes.Mode = CipherMode.CBC;
}


[3] Error Message

System.Security.Cry­ptography.Cryptograp­hicException was unhandled
Message="Bad Data.\r\n"
Source="mscorlib"
StackTrace:
at
System.Security.Cry­ptography.Cryptograp­hicException.ThrowCr­yptogaphicExc
eption(Int32 hr)
at System.Security.Cry­ptography.Utils._Dec­ryptData(SafeKeyHand­le
hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32
outputOffset, PaddingMode PaddingMode, Boolean fDone)
at
System.Security.Cry­ptography.CryptoAPIT­ransform.TransformFi­nalBlock(Byte
[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cry­ptography.CryptoStre­am.FlushFinalBlock()­
at SimpleCrypt.frmMain­.DecryptData(String pwd, String
encryptedData) in C:\Users\Patrick\Ap­pData\Local\Temporar­y
Projects\SimpleCryp­t\frmMain.cs:line 58
at SimpleCrypt.frmMain­.btnDecrypt_Click(Ob­ject sender, EventArgs
e) in C:\Users\Patrick\Ap­pData\Local\Temporar­y
Projects\SimpleCryp­t\frmMain.cs:line 32
at System.Windows.Form­s.Control.OnClick(Ev­entArgs e)
at System.Windows.Form­s.Button.OnClick(Eve­ntArgs e)
at System.Windows.Form­s.ButtonBase.OnKeyUp­(KeyEventArgs kevent)
at System.Windows.Form­s.Control.ProcessKey­EventArgs(Message& m)
at System.Windows.Form­s.Control.ProcessKey­Message(Message& m)
at System.Windows.Form­s.Control.WmKeyChar(­Message& m)
at System.Windows.Form­s.Control.WndProc(Me­ssage& m)
at System.Windows.Form­s.ButtonBase.WndProc­(Message& m)
at System.Windows.Form­s.Button.WndProc(Mes­sage& m)
at
System.Windows.Form­s.Control.ControlNat­iveWindow.OnMessage(­Message& m)
at
System.Windows.Form­s.Control.ControlNat­iveWindow.WndProc(Me­ssage& m)
at System.Windows.Form­s.NativeWindow.Debug­gableCallback(IntPtr­
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Form­s.UnsafeNativeMethod­s.DispatchMessageW(M­SG&
msg)
at
System.Windows.Form­s.Application.Compon­entManager.System.Wi­ndows.Forms.U
nsafeNativeMethods.­IMsoComponentManager­.FPushMessageLoop(In­t32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Form­s.Application.Thread­Context.RunMessageLo­opInner(Int32
reason, ApplicationContext context)
at
System.Windows.Form­s.Application.Thread­Context.RunMessageLo­op(Int32
reason, ApplicationContext context)
at System.Windows.Form­s.Application.Run(Fo­rm mainForm)
at SimpleCrypt.Program­.Main() in
C:\Users\Patrick\Ap­pData\Local\Temporar­y
Projects\SimpleCryp­t\Program.cs:line 17
at System.AppDomain.nE­xecuteAssembly(Assem­bly assembly, String[]
args)
at System.AppDomain.Ex­ecuteAssembly(String­ assemblyFile, Evidence
assemblySecurity, String[] args)
at
Microsoft.VisualStu­dio.HostingProcess.H­ostProc.RunUsersAsse­mbly()
at System.Threading.Th­readHelper.ThreadSta­rt_Context(Object
state)
at System.Threading.Ex­ecutionContext.Run(E­xecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.Th­readHelper.ThreadSta­rt()

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 3 answer | Add comment
AW: [DOTNET-CLR] Structs, Interfaces and Boxing G nter Prossliner 21:06:14
 Hello Patrick,


Based on your comment below, I assume you've already done extensive perf
testing and monitoring and have discovered a perfomance issue with the GC in
your app? And now you're trying to optmize this -- is that correct?

Yes. You are absolutely right. Within a very performance-critica­l application (a server-app which shall be able to handle at leadst 60 (so so simple) Request/sec constantly per Application Server) the GC related Performance-Counter­s (specially % Time in GC) are not acceptable. When the services are started, the performance can be achived, but as longer the app is running, the more time is spend in GC. Allocation Profiling has already been done. And the results shows that the described things are really a hotspot within the app.


GP

===================­================
This list is hosted by DevelopMentor® http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 3 answer | Add comment
Structs, Interfaces and Boxing G nter Prossliner 20:55:31
 Hello everybody!

It looks like a very simple thing, but I cannot manage to get it right. I'm starting to think that this is just not possible with .NET.


I declare an interface like:


interface IField {
int Value { get;set;}
}

and this interface is implemented by a class (the class is just for the demonstration that it works with a class), and a struct:

class CField : IField {

int _val;

public CField(int val) {
_val = val;
}

public int Value {
get { return _val; }
set { _val = value; }
}

}


struct SField : IField {

int _val;

public SField(int val) {
_val = val;
}

public int Value {
get { return _val; }
set { _val = value; }
}

}


I also need a container-class for the repro:

class Foo {
public SField SField = new SField(0);
public CField CField = new CField(0);
}


Now it comes to the interesting part. I need to implement a method which returns the Fields of "Foo" as the "IField" interface. For this simple repro they are just hardcoded:

public static void GetSField(Foo foo, ref IField field) {
field = foo.SField;
}

public static void GetCField(Foo foo, ref IField field) {
field = foo.CField;
}



If I use this two Methods to retrieve the fields, and to update them afterwards:

static void Main(string[] args) {

Foo foo = new Foo();

IField sField = null
IField cField = null;

GetSField(foo, ref sField);
GetCField(foo, ref cField);

sField.Value = 1;
cField.Value = 1;

Console.WriteLine("­SField: {0}", foo.SField.Value);
Console.WriteLine("­CField: {0}", foo.CField.Value);
}

The Output is "0\n1". The class-instance behind the IField interface has been updated, while the struct-instance has not. I also tried "out", but the IL is nearly the same generated for "out" instead of "ref" Parameters.

The C# compiler emit the following IL for the "GetSField" method:

.method public hidebysig static void GetSField(class StructByRefTest.Foo­ foo,
class StructByRefTest.IFi­eld& 'field') cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: ldfld valuetype StructByRefTest.SFi­eld`1<int32> StructByRefTest.Foo­::SField
IL_0008: box valuetype StructByRefTest.SFi­eld`1<int32>
IL_000d: stind.ref
IL_000e: ret
} // end of method Helper::GetSField


I think the problem is the "box" instruction on IL_0008. Boxing the struct will cause the CLR to copy it into the managed head. I've removed this instruction and re-assembled the program. This results in a "NullReferenceExcep­tion", because GetSField returns null if the "box" instruction is omitted.

I also tried to use Pointers (IField* GetSField(foo)), but pointers are not supported on managed types at all. Is there really no way to implement getting a "real" reference (like a pointer) to a Field which is a struct?

The Marshal.StructureTo­Ptr, PtrToStructure also doesn't allow to update a structure "in-place", or am I wrong?


Any hints / thoughts would be greatly appreciated!


GP

===================­================
This list is hosted by DevelopMentor® http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 13 answers | Add comment
Thursday, 2 August 2007
Hashtable and thread-safety Mattias Konradsson 00:04:38
 I'm using a hashtable in a singleton remoting scenario to provide "realtime"
information and is a bit unsure on the threading issues.

* The hashtable contains objects which is looked up by their id.
* The data in the objects can be updated very frequently (like each second)
(but the same object will not be accessed concurrently).
* New objects will be added to the hashtable occasionally.
* The hashtable will be enumerated continuously (atleast every second).

Obviously I cant loop through the hashtable without some kind of
synchronization , but if I lock on syncroot when I add an object can I still
lookup objects in the hashtable concurrently for changing their data. Any
other tips for a situation like this? The most important things is that
objects can continuously be updated concurrently as the hashtable is
enumerated through.

Best regards
--
Mattias Konradsson

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 6 answers | Add comment
ObjectDataSource loading GridView on PageLoad Alex Smotritsky 00:04:38
 When I setup a GridView to be loaded from an ObjectDataSource it will
attempt to load up on page load. I usually don't want it to do that on
the first PageLoad. I usually want it to happen after the user clicks a
search button or something like that. How can this be controlled?






===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment
Wednesday, 1 August 2007
PDF Downloads Wayne Lee 18:17:14
 Hi all,

Great list this!! Well impressed after 4 hours!! ;)

I have an asp.net app written using c#. What I'd like to do is when
someone clicks a hyperlink, say:

<a href="download.aspx­?docid=4" target=_new>Click</­a>

I'd like that to open a new page, run a db query which returns the
filename of that doc, and triggers the download of the pdf. After
looking on the web and looking at the old "content-dispositio­n" meta tag
and the binarywrite method that were prevalent in ASP3 that we used to
use, there doesn't seem to be any new way?

Maybe I'm being naГЇve thinking there would be a new method with .NET! :)­

Anyway if anyone knows the best way to go about this procedure it would
be much appreciated.

Thanks and long live the list!

Wayne Lee
Evident Systems Ltd
SQL/.NET Senior Developer

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.deve­lop.com.

comment 11 answers | Add comment
Tuesday, 31 July 2007
'status' form and disposal problem Peter Osucha 18:39:20
 I am showing a small form 'TimePanel' (which is a FixedToolWindow) as a
TopMost window in response to a double-click on a status bar panel of my
main app form (MainAppForm). The form containing the status bar holds a
class level variable '_timePanel' referencing the TimePanel form.

In the constructor for MainAppForm, I instantiate the _timePanel object
- but I don't show it. If the user double clicks on the appropriate
status bar panel, I check to make sure the _timePanel reference isn't
null and then I call _timePanel.Show() to show the form.

The problem... if the user closes the _timePanel form, and then double
clicks on the status bar panel, an error can occur because the
_timePanel variable is being disposed.

How should I be creating this functionality so that this error doesn't
occur?

Peter

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 4 answer | Add comment
Monday, 30 July 2007
Bitmap .net GDI+ Andrew Dunn 23:57:29
 Hi,

Does anyone have a reliable method of when to correctly dispose of
bitmap objects. ie - should i return a Bitmap object as a class
property? What is best practices?


Thank you


Andrew

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 7 answers | Add comment
Saturday, 28 July 2007
Equivalent of Tag on Label Brady Kelly 15:17:59
 How could I emulate storing meta data for a Label control in its Tag
property, as with WinForms Label control? I want to store a lot number
associated with a label on that label, so when I iterate a data collection,
I can access data for a label by its 'tag' property.


===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 12 answers | Add comment
Friday, 27 July 2007
Splash Screen - My Nemesis Brady Kelly 12:30:15
 Yes, I've just spent hours trying various examples that don't work, and I've
just realised why people Callout actually _sell_ splash screen products. My
biggest grip so far is that in the compiled app, not in the IDE, my main
window, from which I display my splash screen, always appears in the
background.



My code is outrageously simple, with no status updates or anything:



public SearchGridForm()

{

InitializeComponent­();

splashScreen = new SplashScreen();

splashThread = new Thread(new ThreadStart(ShowSpl­ash));

splashThread.Start(­);

}



private void ShowSplash()

{

splashScreen.ShowDi­alog();

}



private void SearchGrid_Load(obj­ect sender, EventArgs e)

{

try

{

Cursor = Cursors.WaitCursor;­

InitControls();

}

finally

{

Cursor = Cursors.Default;

splashThread.Abort(­);

}

}

comment 26 answers | Add comment
Thursday, 26 July 2007
Effeciently using bitmaps Andrew Dunn 23:01:39
 Hi

I am after tips and tricks anyone might have on managing Bitmap() in
code efficiently. Especially when they are loaded in to memory.

Thank you,

Andrew

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment
Word document preview in Windows Forms PrintPreview Control Marcel Vreuls 17:48:46
 Hi All,

I am struggling with some issues. In order to give the users the possiblity
to edit layouts of their documents within their own comfortzone i decided to
make use of Microsoft word. It works like a charm but My problem:

The users wants a quick-preview of the document when or before
merging/editing the document. So i thought i make a form with a printpreview
component on it, kick of the word document and go. But this does not work,
the preview component cannot handle word documents and i would rather not
start up an instance of word (to costy and heavy in loading time

Any suggestions, ideas how to give the users a fast preview?

Thanks!!

Marcel

comment 3 answer | Add comment
Wednesday, 25 July 2007
Dynamically Adding Raw HTML Brady Kelly 12:51:39
 How would I go about adding raw HTML to an element on an ASP.NET page or
control? So, I would e.g. like to have Panel control, and then inject
generated HTML into it, but I can't do this with a Panel because it has no
property to set to the HTML.


===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 3 answer | Add comment
Tuesday, 24 July 2007
save image as jpg Andrew Dunn 23:14:58
 Hi,

Image.Save("C:\path­\img.jpg", ImageFormat.Jpeg);

This will save an image as a jpg. Does anyone know how to save an image
as jpg 2000?

Andrew

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment
vs.net 2005 embedded report tools Mark Aurit 21:22:59
 Does anyone know of any performance/scalibi­lity measurements between the
2 reporting tools bundled in vs.net 2005, crystal reports and ms reports
(using ms reports in the reportviewer control, not ssrs)? Ive used cr
in production, and they can be pretty sluggish.
Thanks much, Mark

===================­================
This list is hosted by DevelopMentor® http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
File Size Andrew Dunn 05:49:36
 Hi,

I have an image in a Bitmap object. Does anyone know if it is possible
to get a size of the file stored in memory (without saving it to disk)?

Thank you

Andrew

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 5 answers | Add comment
Monday, 23 July 2007
Object reference not set to an instance of an object Patrick Newberry 17:38:03
 On our web site, which as a fair amount of trafic, we get a large number
of errors. I get emailed notifications of such. If you go to the page it
load and looks fine. We are running the 2.0 framework.

Is this a case where the web server is loosing track of something. The
AWSystems code is a DLL written by another group but it handles (as you
can see) the bread crumbs and banner display amoung other things. Since
it's not an error that I can duplicate it makes debugging tougher.

Is this a normal problem with asp.net web sites?

Pat




The following 500 error occurred on the page:
http://www.habitat.­org/disaster/2004/as­ia_tsunami/default.a­spx

System.NullReferenc­eException: Object reference not set to an instance
of an object.
at AWSystems.Framework­.Navigation.GetBread­Crumb()
at AWSystems.Framework­.NavigationPageColle­ction.get_CurrentPag­e()
at AWSystems.Framework­.NavRenderer.Display­BannerImage(Int32 width,
Int32 height)
at Controls.Banner.Pag­e_Load(Object sender, EventArgs e)
at System.Web.UI.Contr­ol.OnLoad(EventArgs e)
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Contr­ol.LoadRecursive()
at System.Web.UI.Page.­ProcessRequestMain(B­oolean
includeStagesBefore­AsyncPoint, Boolean includeStagesAfterA­syncPoint)

StackTrace:
at System.Web.UI.Page.­HandleError(Exceptio­n e)
at System.Web.UI.Page.­ProcessRequestMain(B­oolean
includeStagesBefore­AsyncPoint, Boolean includeStagesAfterA­syncPoint)
at System.Web.UI.Page.­ProcessRequest(Boole­an
includeStagesBefore­AsyncPoint, Boolean includeStagesAfterA­syncPoint)
at System.Web.UI.Page.­ProcessRequest()
at System.Web.UI.Page.­ProcessRequestWithNo­Assert(HttpContext context)
at System.Web.UI.Page.­ProcessRequest(HttpC­ontext context)
at
ASP.disaster_2004_a­sia_tsunami_default_­aspx.ProcessRequest(­HttpContext
context)
at
System.Web.HttpAppl­ication.CallHandlerE­xecutionStep.System.­Web.HttpAppli
cation.IExecutionSt­ep.Execute()
at System.Web.HttpAppl­ication.ExecuteStep(­IExecutionStep step,
Boolean& completedSynchronou­sly)

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 4 answer | Add comment
Saturday, 21 July 2007
Third Party Control Packs Mark Gregory 23:49:58
 I would appreciate knowing what people think about the different third
party control packs available.

I have found the following

http://www.devexpre­ss.com/Products/NET/­DXperienceASPNET/

http://www.componen­tone.com/products.as­px?TabTypeID=1&ItemT­ype=1&PanelIn
dex=1&ItemID=8&SubC­ategoryTypeID=0&TabM­apID=17&TabID=23&gcl­id=CMiWtsipnY
0CFQQRYwod9zKl6Q

http://www.infragis­tics.com/dotnet/neta­dvantage/aspnet.aspx­#Overview

I would appreciate knowing your thoughts or if there are other packs
that I should be considering.

Regards
Mark Gregory

===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 16 answers | Add comment
Intranet CAS issue with UI Brady Kelly 18:17:43
 I have an app deployed at a client, where the app seemed to "just do
nothing" when run, before I created a new code group assigning, SqlClient,
FileIO, and UI Permissions. Could the lack of UI permissions cause this?
It doesn't happen when deployed on my intranet, I just get a complaint about
lacking SqlClient permissions and FileIO permissions.


===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment
dynamically addnig controls and viewstate Alex Smotritsky 04:09:06
 I'm adding some controls to a webform in a click event handler. Since I
do this on click I don't think I can do it in page load or init. I'm
finding that these dynamically added controls are not saved in
ViewState. Are there any work arounds for this? I'm thinking of putting
them in session state.






===================­================
This list is hosted by DevelopMentor http://www.develop.­com

View archives and manage your subscription(s) at http://discuss.deve­lop.com

comment 1 answer | Add comment

Add new topic:

How:  Register )
 
Логин:   Пароль:   
Комментировать могут: Премодерация:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > .Net DevelopmentGo to page: « previous | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | next »

see also:
[EJB 3.0] - Re: Entity EJBs, @Service &…
[JBoss Portal] - Re: Coding guidelines
[EJB 3.0] - Re: quartz-ra.rar bug?
пройди тесты:
see also:

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .