|
Do you mean NameValueCollection ? If yes, see the documentation[^]. It shows how to iterate the collection.
|
|
|
|
|
To add items to a ListView you have to create a ListViewItem object and add it to the ListView.Items collection via the ListView.Items.Add() method. The ListViewItem object has a bunch of constructors, so just find one that meets your needs. I typically use the one that takes string[] , because I typically use the ListView in Details mode. So, I'll have columns defined for the ListView and each index of the string[] in the ListViewItem constructor corresponds to the column with the same index. So, all you have to do for that constructor is make a string[] where index 0 is the data for column 0, index 1 is the data for column 1, etc.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Can you help me in C# code for checking the prefix of a message.I hav to check whether the prefix is available or not using the database..as the duplication of prefix is not allowed....
Boolean IsPrefixAvailable (String phoneNumber, String prefix)
(To check whether this prefix is used by another application before) (Return true = Available, false = Not Available)....
|
|
|
|
|
|
|
I haven't seen this[^] kind of chart in crystal report. Other type is possible.
|
|
|
|
|
|
Guys,
Looking to create a Web Form that allows users to input multiple data entries, i.e. name, height and sex. When the data is submitted it is displayed in a 'text area'.
Two wrinkles:
a) The 'row' should contain a delete option, if selected the line would be removed
b) The user can enter/submit multiple data lines
I am having trouble finding a good way to do this.
One idea is to use cookies to store the data and then paint the page using dynamically created tables. This is messy and not a good solution.
Any help is appreciated!
Thanks
Jason
|
|
|
|
|
JasonBerb wrote: Looking to create a Web Form that allows users to input multiple data entries, i.e. name, height and sex. When the data is submitted it is displayed in a 'text area'.
Text area is not suitable for this. Use a GridView or DataGrid . When each item is added, add a new item to the grid datasource and rebind the grid.
BTW, this question has to be in ASP.NET forum.
|
|
|
|
|
I have an app which displays the correct icon in the task bar when multiple instances of the app aren't grouped on the task bar. However once they become grouped the icon changes to one of my older icons and I cannot find where this older icon is set inside VS. Anybody help?
|
|
|
|
|
An icon file can contain several images in different sizes. When displaying the icon it picks the image that is closest in size. Might your icon file contain both old and new images?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Nope the icon file contains only one image.
|
|
|
|
|
I have been looking at a few projects about cryptography.
Now the thing i can't figure out is why do string become longer in size when encrypted and files don't?
strings easily double in size "test" because 24 chars long.
But when i encrypted a 5.04MB picture the size remained exactly the same to the byte, and it was encrypted fully.
I used this project:
http://www.codeproject.com/KB/recipes/Encrypt_Decrypt_File_Data.aspx[^]
Although i think the same goes for all projects.
Thanks for reading.
|
|
|
|
|
Many algorithms encrypt block by block. The minimum you can encrypt is one block, which is why your short string ends up bigger when encrypted (it gets padded out to a full block).
|
|
|
|
|
Encryption deals with bytes, so if you encrypt from a string to a string you first encode the string into bytes, encrypt, then represent the encrypted bytes as a string.
If you use UTF-16 (Encoding.Unicode.GetBytes method) to encode the string, each character is stored as two bytes. If you then represent the encrypted bytes as a string in hexadecimal format, it doubles again. Using base-64 to represent the bytes as a string is more compact, as it only adds another 33%.
The UTF-8 encoding is more compact, as it stores the most common characters in a single byte.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am using Visual Studio 2008 for the first time. I am trying to consume a web service by using a local copy of the WSDL. The actual web service is up and running, but it does not have a public WSDL or Discovery files. I have the acutal WSDL and a couple of XSD documents on my local machine, but I can't figure out how to get VS to use it.
When I click "Add Web Reference", it expects a URL. When I navigate to my local file system, it shows "Access to the path is denied". I have the group "Everyone" set to full control on this directory thinking it was a permission problem.
What am I doing wrong? I just upgraded from 2003 to 2008 and am having culture shock!
Thanks in advance...
-Scott
|
|
|
|
|
I'm filling a datagridview with rows of data and upon selection (RowEnter event) of a full row the primary key is copied into a textbox which is then used as a foreign key in another table and gives me the quantity of rows containing the foreign key.
This is fine and dandy, except when I click on the DataGridView headers it throws an exception:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Any ideas as to why this is occurring? Thanks in advance!
|
|
|
|
|
Well, I got around the issue with a try/catch block. Out of curiosity, however, I'd love to know if there are other alternatives to this.
|
|
|
|
|
Hi all,
I have two aspx pages which have one gridview table each. the second gridview is dependent on the other based on which row you select in the first gridview table.
Ive used the configuraztion wizard for the 2nd table to generate the table based on the session value ie Session["Selection"].
However the problem occurs when, Im using session values between the pages, and when the event handler is fired, it doesnt transfer the session value to the next page and hence the 2nd pages shows nothing.
I managed succeed in doing this in another project and have compared it many a time yet I cannot spot the difference in the way I have coded this. Yet one works and the other doesnt.
Heres my code. Thanks + Cheers
1st page
protected void ViewCustomer(object sender, EventArgs e)
{
Session["Selection"] = GridView1.SelectedDataKey.Value
Response.Redirect("~/Master/SelectionBetweenTwoPagesPageTwo.aspx");
}
<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" xmlns:asp="#unknown">
CellPadding="4" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="None" Height="139px"
OnSelectedIndexChanged="ViewCustomer" Width="448px">
<footerstyle backcolor="#990000" font-bold="True" forecolor="White" />
<rowstyle backcolor="#FFFBD6" forecolor="#333333" />
<columns>
<asp:boundfield datafield="CustomerID" headertext="CustomerID" readonly="false">
SortExpression="CustomerID" />
<asp:boundfield datafield="CompanyName" headertext="CompanyName">
SortExpression="CompanyName" />
<asp:boundfield datafield="ContactName" headertext="ContactName">
SortExpression="ContactName" />
<asp:boundfield datafield="ContactTitle" headertext="ContactTitle">
SortExpression="ContactTitle" />
<asp:hyperlinkfield navigateurl="~/Master/SelectionBetweenTwoPagesPageTwo.aspx">
Text="View" />
</asp:hyperlinkfield></asp:boundfield></asp:boundfield></asp:boundfield></asp:boundfield></columns>
<pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
<selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy" />
<headerstyle backcolor="#990000" font-bold="True" forecolor="White" />
<alternatingrowstyle backcolor="White" />
</asp:gridview>
<asp:sqldatasource id="SqlDataSource1" runat="server" xmlns:asp="#unknown">
ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>"
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]">
</asp:sqldatasource>
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Selection"] != null)
{
int customerid = (int)Session["Selection"];
}
}
|
|
|
|
|
CrimeanTurtle2008 wrote: //2nd page
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Selection"] != null)
{
int customerid = (int)Session["Selection"];
}
}
This above code does nothing useful. You test if there is something in the session. If so you capture it in to a local variable (that does not exist outside the scope of the Page_Load method) and does nothing with it.
|
|
|
|
|
I have debugged this process step by step and, indeed it doesnt do much. However I have solved this problem now as I realised that the datatype should have been a string instead of an integer. Thanks again Colin.
|
|
|
|
|
I cannot figure this out..
Basically I read the bytes from my database, saved it to he harddrive, then attached it to an email, then delete the file. So I wanted to put this in a stream or memorystream then attach it to an email so I skip all the file saving.
myReader = cmd.ExecuteReader();
while (myReader.Read())
{
FileData = myReader["Saved_File"].ToString();
byte[] buffer = new byte[FileData.Length];
ms.Read(buffer, 0, FileData.Length);
mm.Attachments.Add(new Attachment(ms, myReader["Filename"].ToString()));
}
It attaches, but only up to 77 bytes. I'm lost.. In my database it is stored as a varbinary(MAX).
It works if I save it to the harddrive. I just want to skip all of that.
|
|
|
|
|
Jacob D Dixon wrote: FileData = myReader["Saved_File"].ToString();
Is Saved_File the byte array or is for example the original name of the file? I would guess, that you have used it for both purposes because later you have:
Jacob D Dixon wrote: byte[] buffer = new byte[FileData.Length];
Also your post doesn't show how the memory stream is constructed or what's the type of FileData so it's quite hard to say if they are correctly.
|
|
|
|
|
I'm sorry I have never done this before.
What I have there is what I've tried to get to work from what I've seen on the internet.
myReader["Saved_File"].ToString(); is reading the varbinary from the SQL database (Saved_File) column.
So i'm taking the string FileData and storing the information in the SQL database in the string.
So what I'm trying to do is take the data from the database and attach it in an email without actually saving a file to the harddrive then deleting it when I'm done. I'm wanting to store the file in memory, then attach it to the email and send it. Is this possible?
|
|
|
|
|
You have to loop on the read in order to get all of the data from the stream. The read method returns number of bytes read, loop until number of bytes read == number of bytes in file.
Also, to string will only cause things to break. It is the most overused and misunderstood feature of .NET apparently.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|