Home All Groups Group Topic Archive Search About

RE: Gridview templaye button control

Author
29 Dec 2008 4:49 AM
Allen Chen [MSFT]
Hi Morris,

How's everything going?

I would appreciate it if you could drop me a note to let me know the status
of the issue in the thread. If you have any questions or concerns, please
feel free to let me know. I am happy to be of assistance.

Regards,
Allen Chen
Microsoft Online Support

Author
4 Jan 2009 11:37 PM
Morris Neuman
Hi Allen,

The upload, file browse button worked.  Thanks.

I have not started to learn about Silver Light so have not tried the wav
file check code.. 

Where would I insert the XAML code or how do I create this file type?
--
Thanks
Morris


Show quoteHide quote
"Allen Chen [MSFT]" wrote:

> Hi Morris,
>
> How's everything going?
>
> I would appreciate it if you could drop me a note to let me know the status
> of the issue in the thread. If you have any questions or concerns, please
> feel free to let me know. I am happy to be of assistance.
>
> Regards,
> Allen Chen
> Microsoft Online Support
>
>
Author
5 Jan 2009 11:07 AM
Allen Chen [MSFT]
Hi Morris,

To learn Silverlight you can refer to this page:

http://silverlight.net/GetStarted/

We need to install Silverlight Tools for Visual Studio first.

If you don't want to use RIA technique I think we have to do the check
after uploading, as mentioned in one of my previous posts:

Aspx:
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Button1" runat="server"
        Text="Upload" onclick="Button1_Click" />

Aspx.cs:
    protected void Button1_Click(object sender, EventArgs e)
        {
            bool _ismono = false;
            int _samplerate = 0;
            int _bitspersample = 0;
           byte[] filebytes= this.FileUpload1.FileBytes;
           if (filebytes.Length >
44&&this.FileUpload1.FileName.ToLower().EndsWith(".wav"))
           {
               _ismono = filebytes[22] == 1 && filebytes[23] == 0;
               byte[] samplerate = new byte[4] { filebytes[24],
filebytes[25], filebytes[26], filebytes[27] };
               _samplerate = BitConverter.ToInt32(samplerate, 0);
               byte[] bitspersample = new byte[2] { filebytes[34],
filebytes[35] };
               _bitspersample = BitConverter.ToInt16(bitspersample, 0);
           }
        }


We can also use RegularExpressionValidator control directly:

<asp:RegularExpressionValidator ControlToValidate="FileUpload1" 
ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.[wW][aA][v
V])$"  ID="RegularExpressionValidator1" runat="server" ErrorMessage="Only
wav file can be uploaded!">
</asp:RegularExpressionValidator>

<asp:FileUpload ID="FileUpload1" runat="server"/>
<asp:Button
     ID="Button1" runat="server" Text="Button" />

In this way we can check the extension but cannot check the content of the
wav file at client side.

Please feel free to let me know if you have further questions.

Regards,
Allen Chen
Microsoft Online Support
Author
13 Jan 2009 5:47 AM
Allen Chen [MSFT]
Hi Morris,

Do you have additional questions on this issue?

Regards,
Allen Chen
Microsoft Online Community Support