|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RE: Gridview templaye button controlHi 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 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? -- Show quoteHide quoteThanks Morris "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 > > 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 Hi Morris,
Do you have additional questions on this issue? Regards, Allen Chen Microsoft Online Community Support |
|||||||||||||||||||||||