|
So, where is the problem? Add a menu to your forms and add Menu Items and finally implement the event handlers for the Menu.
Manoj
Never Gives up
|
|
|
|
|
Hi
I am trying to upload file using Http Post, I need to set content type-multipart.Please advise..
I tried many ways but not succesful..
Thanks
|
|
|
|
|
Is this in a browser scenario, or is this in a desktop scenario? With ASP.NET, the best way to upload a file is with the FileUpload control. In a desktop situation, use WebRequest.Create() to create a web request. Set the ContentType property on the request, and then get a response for it:
WebRequest request= WebRequest.Create(url);
request.ContentType="multipart/form-data";
request.Method="POST";
Stream stream=request.GetRequestStream();
WebResponse response= request.GetResponse();
--Justin
Microsoft MVP, C#
|
|
|
|
|
My requirement is, i added 50 empty rows to the Data grid. One of the columns of the datagrid is of ComboBoxColumnStyle. Now after filling data into just two rows (remember i have 50 empty rows), when i click on column header of ComboBoxColumnStyle columns it is sorting the total 50 rows, but i want to ignore the empty rows (other 48 rows). Because if i don't ignore the empty rows and sort the rows with data are being moved to end of the grid, leaving all above rows empty.
Any ideas, how to sort rows only with data?
Thanks
kumar
|
|
|
|
|
Hi,
You can set the "SortMode" properties for the column as "Programatic". In this case you can control the time when you want the sorting to take place.
Manoj
Never Gives up
|
|
|
|
|
its simple write one for loop for geeting all the data from datagrid and check within for loop the data is available or not .if the data is available sort the data.
|
|
|
|
|
In which event should i write this code?
|
|
|
|
|
Hi,
I declare a HashTable as a class variable, and assign values to it inside a private fuction. I try to access the HashTable in another function, but the order of the Keys added is lost.
If I have added keys in the order 1, 2 and 3 (with its Value), when I access the HashTable the order is lost, it may be in 2-3-1 order or some other order.
Usually hashtable retains the order, could anyone point what going wrong here.
Regards,
Blumen
|
|
|
|
|
Hello,
No Hashtable is not holding the order.
An ArrayList does.
All the best,
Martin
|
|
|
|
|
|
you can use sorted list, if you want that in an order
My small attempt...
|
|
|
|
|
Hashtable never orders the keys. You can NEVER rely on that. Use a SortedList instead.
|
|
|
|
|
hi,
i hava following error :
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
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.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.]
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +483
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Page.LoadAllState() +559
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2237
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
can any body tell the solution
|
|
|
|
|
You need to reset the page's viewstate after adding the controls dynamically, then it will recreate it, and all should be fine.
|
|
|
|
|
I'm trying to make a call into a compression dll
This is declared like this in VB6:
<br />
Private Declare Function compress Lib "compression.dll" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long<br />
Private Declare Function uncompress Lib "compression.dll" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long
I've added the following to a c# class
<br />
[DllImport("compression.dll")]<br />
public static extern int uncompress(ref byte[] inputBuffer, ref int inputLength, ref byte[] outputBuffer, int OutputLength);<br />
[DllImport("compression.dll")]<br />
public static extern int compress( [MarshalAs(UnmanagedType.LPStr)] StringBuilder inputBuffer,ref int inputLength, [MarshalAs(UnmanagedType.LPStr)] StringBuilder outputBuffer, int OutputLength);
If i call the compress method using c# and decompress using c# this works fine. The problem arises when i try to compress in c# and decompress in vb6 or vice versa. Is there a back compatability mode for string functions like this?
Thanks in advance
Russell
|
|
|
|
|
Russell Jones wrote: The problem arises
What is the problem... an error message, invalid data, what? Please provide a little detail.
|
|
|
|
|
what is sub-classing in C#, and hw to achive that.
|
|
|
|
|
//a.k.a inheritance.
//so for example...
public class ClassOne : ClassBase
{
//this class is a subclass of ClassBase
}
public class ClassTwo : ClassBase
{
//this class is a subclass of ClassBase
}
public class ClassBase
{
protected int X = 5; // The two subclasses can access this variable as its been "inherited"
}
|
|
|
|
|
i want to select the text written in the rich text box
|
|
|
|
|
hi
myrichtextbox.SelectAll():
regards
|
|
|
|
|
Hello treah,
with the RTFControl1.SelectionStart and RTFControl1.SelectionLength will give you the start and length (int) so you can get the text!
Hope that helps
Nassos
GanDad
|
|
|
|
|
Hi all.
Im trying to load data into a combo box during form load.The items Im trying to load are from a database.
Now here is my little code that gives me errors.
protected void Page_Load(object sender, EventArgs e)
{
con.ConnectionString = str;
String str1 = "Select * from Filter";
con.Open();
cm.Connection = con;
dtr = cm.ExecuteReader();
if (dtr.Read())
{
// Load FilterByKeys onto the combo box
cboExtension.Text = (dtr["FilterKey"]).ToString();<<*****Problem****
lblMessage.Text = "Good. All the values are loaded";
Thanx.
kagiso
|
|
|
|
|
What a mess
matjame wrote: con.ConnectionString = str;
what is str, and why is a member variable named so badly ?
matjame wrote: String str1 = "Select * from Filter";
You never use this anywhere, so it's irrelevant to the rest of the code.
What is con, cm and dtr ? Why do you have badly named member variables like this, that probably could be local, and are not named in a way that means anything ?
matjame wrote: cboExtension.Text = (dtr["FilterKey"]).ToString();<<*****Problem****
What's the problem ? Does it not compile ? Does it blow up ? What's the error message ?
This is also not going to do more than add one value into the combo box. That's what the Text property will do. To add items, make a collection the datasource, and if it's not a collection of strings, set the DisplayMember property.
All of this looks to me like you're making it up as you go and hoping it will work. Intellisense is no substitute for reading MSDN or buying a good book as a reference.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
DataTable status = new DataTable();
status = ExecuteNonQuery_SP("Select * from Filter");//getting the value
cmbStatus.DataSource =status ;
cmbStatus.DisplayMember = "Status_Name";
cmbStatus.ValueMember = "Status_Id";
give the displaymember and valuemember to the combobox'x object
here cmbStatus is the combobox
My small attempt...
|
|
|
|