|
Right click on the node of your web application in the Solution Explorer, and select Add Web Deployment Project.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi all,
I have an application in which i have a section for uploading files to the server. This part is working fine. But while uploading i want to see the progress of upload (in the same page or a new popup page) and after finishing i want to stop showing the progress. Can anyone please help.
Here is the code which i have given for uploading. I have used the file upload tool in .net 2005.
If fileUpEx.HasFile Then
Dim filepath As String = fileUpEx.PostedFile.FileName
Dim pat As String = "\\(?:.+)\\(.+)\.(.+)"
Dim r As Regex = New Regex(pat)
'run
Dim m As Match = r.Match(filepath)
Dim file_ext As String = m.Groups(2).Captures(0).ToString()
Dim filename As String = m.Groups(1).Captures(0).ToString()
Dim file As String = filename & "." & file_ext
'save the file to the server
fileUpEx.PostedFile.SaveAs(Server.MapPath(".\") & file)
Response.Write("File Saved to: " & Server.MapPath(".\") & file)
End If
Thanks You
|
|
|
|
|
|
Hi All,
I m new to vb.net .i m creating a website and wants that when
the first page is loading the comment like Loding... should be
displayed to the user . and after page ic loded completely then
msg should be disapeared.
Hope u will understand my problem ans wil reply soon.
Tahks in advance.
-sohan
|
|
|
|
|
|
Hi,
I'm using TreeView as my SiteNavigation control. And it works fine. I'm not using the standard web.sitemap for storing my sitemap nodes, instead they are partly stored in a database and partly autogenerated (depending on content). Note that there are no postback events associated with the tree, it is simply populated with these site map nodes at startup, the user then clicks a node in the tree (a standard a href) and a new page is displayed. I'm also using master pages, and the tree is hosted inside the master page.
What I would like to accomplish is to show the user where in the tree (s)he is located. The default behaviour is simply to display a certain depth at the beginning (fixed depth, all nodes above will be expanded), and I've currently set the depth to 1, i.e. just display the first level of nodes. But if my user clicks a node located in "Blogs" - "2006" - "December", he will be taken to a new page (or the same page with different query string parameters, depends on the type of node he clicked), but the tree will again display just the root nodes. Could I adjust the tree so it will expand the currently selected node? I tried adding code in Page_Load in the master page to check what nodes the tree contains, but all I get is a list of the root nodes.
Any help would be greatly appreciated,
regards,
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Has anyone an idea how to display an image from database. I tried using image control but it only has property imageUrl(or something) and my image is sequence of bytes.
Nadya
|
|
|
|
|
|
wrote: I tried using image control but it only has property imageUrl(or something) and my image is sequence of bytes.
Of course, images are NOT part of a page. When you view source of page, do you see actual images' data in it? No. You can save image temporary on server as a file and set ImageUrl to path of that file. Or reconsider your database structure, maybe it will be better to store images in filesystem and in DB keep only paths to images? Or, if you want to display ONLY image, Response.Write the bytes on blank page and in header set right MIME type, e.g image/jpeg (use Response.ContentType ).
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
It makes a lot more sense to make a page that does a binary write of the image (e.g. images.aspx?picid=1) and set that as the ImageUrl (or src) property of the image control.
|
|
|
|
|
Yup that would be nice solution. 5
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi there:
The idea is that you can read the imgae and then write to the Response object as a stream of bytes...
You can find articles related to this on this site...
<< >>
|
|
|
|
|
pls see the below table:
products stock
-----------------
AAAA 300
BBB 200
CCC 400..
-----------------
the above table shows products and stock. now when I login, the page has to display alert messages like " Product AAA contains 300 items". How can I do this using asp.net and c#.Just I need logic. can any one help? this is urgent.
Thanks..
|
|
|
|
|
What you need to do is to first get the data from the database and then create a string with the data from the database and display the string. There can be other methods also to display the data depending upon the requirement.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks. but I want to display that data in a pop up window. I have used
button1.attributes.add("onclick","window.open("onclick", "window.open('Result.aspx?r=" +re+ "',null,'height=250, width=650,status= no,resizable= no, scrollbars=no, top=0,toolbar=no,location=no,menubar=no ');");
it is not fired when I click a button. if I click twice it opens result.aspx window. but I need to open in a single click. any solution.?
Thanks
|
|
|
|
|
You have window.open twice that is not required. You write like this, I think after this your problem will be solved.
<br />
Button1.Attributes.Add("onclick","window.open('Directory.aspx?r=" +re+ "',null,'height=250, width=650,status= no,resizable= no, scrollbars=no, top=0,toolbar=no,location=no,menubar=no ');");
Best Regards,
Apurva Kaushal
|
|
|
|
|
Dear All,
I am in a need to read .aspx and .config files from a remote system. For that i have used the following method.
public string DownloadFile(string downloadUrl)<br />
{<br />
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(downloadUrl);<br />
req.Method = "GET";<br />
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();<br />
Stream respStream = resp.GetResponseStream();<br />
StreamReader rdr = new StreamReader(respStream);<br />
string inLine = rdr.ReadLine();<br />
string strResult=string.Empty;<br />
while (inLine != null)<br />
{<br />
inLine = rdr.ReadLine();<br />
strResult +=inLine;<br />
}<br />
rdr.Close();<br />
return strResult;<br />
}
In the above code if i provide URI of a text fiel in a remot system the method reads the file and returns me the content. But the same is not working if i provide URI of a .aspx file. Can any body help me
ThanS in advance
Ramesh.Kanjinghat
|
|
|
|
|
I ran your code from a console application and it seems to work fine for aspx files. I've pasted below my test app based on your code. I requested several different aspx files on my localhost and one from a public url and all were succussful. Can you reach the pages using your web browser?
Also, if you are trying to read .config files you will run into a problem there as ASP.NET will deny all requests for config files. There is a possible way around it, but it would be a big mistake as it would open up a huge security hole giving the public access to your connection strings and other sensitive config info.
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = string.Empty;
while (0 != string.Compare(input, "exit", true))
{
if (!string.IsNullOrEmpty(input))
{
Console.WriteLine(DownloadFile(input));
}
Console.Write("\r\nUrl: ");
input = Console.ReadLine();
}
}
public static string DownloadFile(string downloadUrl)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(downloadUrl);
req.Method = "GET";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream respStream = resp.GetResponseStream();
StreamReader rdr = new StreamReader(respStream);
string inLine = rdr.ReadLine();
string strResult = string.Empty;
while (inLine != null)
{
inLine = rdr.ReadLine();
strResult += inLine;
}
rdr.Close();
return strResult;
}
}
}
|
|
|
|
|
Thanks Mark ,
Well it is working fine for me too. But the exception is that it only reads .aspx files of an application if i copy an .aspx file from a web application and store it in a folder, which is set with web sharing for every one, then it fails to read the content. It will be very help ful for me if you let me the work around to be followed to read .config file.
ThanS in advance.;)
Ramesh.Kanjinghat
|
|
|
|
|
Kanjinghat wrote:
it only reads .aspx files of an application if i copy an .aspx file from a web application and store it in a folder, which is set with web sharing for every one
Not sure what you mean here. Are you trying to read the source of the aspx files? Or just the output? And are you requesting the files from an HTTP server (IIS) or trying to use file sharing? If you're trying to use HttpWebRequest to get the source of the files from a windows share you're using the wrong methods. If this is the case then you need to be using FileStream objects, not request or response objects. When you request files from a share over a network you don't use a web browser, you use windows explorer. Using the WebRequest objects is the equivelent of using your web browser. If you want the equivelent of windows explorer you use the FileStream objects. Also, this means you won't need to open up a security hole in your web application by exposing your config files publicly.
Kanjinghat wrote:
It will be very help ful for me if you let me the work around to be followed to read .config file.
the default setting for .config files is in the httpHanlders section. It's defined as follows:
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler"/>
In order to provide public access you'll need to change the handler for config files. I've never tried it, so I'm not positive which one. But my first guess would be System.Web.StaticFileHandler. If not you may have to roll your own handler which opens the files and spits out the contents to the response steam.
But as a disclaimer, I want to say exposing your config files like this is a really bad idea. If you need programmatic access to the content of remote config files I would suggest using FTP instead. .Net doesn't have any built-in FTP libraries, but I've seen some free ones out on the web.
|
|
|
|
|
HI,
I want to write a regular expression to validate email id.
not the standard email validator.
the email could be in any one of the following formats.
"raj kumar"<kraj@yahoo.co.in>
<kraj@yahoo.co.in>
raj<kraj@yahoo.co.in>
Regards,
Uma
|
|
|
|
|
You can get so many examples on net. This[^] is one of them where you can get some.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi all,
I have GridView which contains few columns of checkbox.My problem is how do I insert or Update Database on save button click(this button is outside the GridView).Following is the code what I have use but not getting where do U update DB:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" Width="100%" CellPadding="4"
ForeColor="#333333" GridLines="None">
<Columns>
<asp:BoundField DataField="FormID" HeaderText="FormID"
InsertVisible="False" ReadOnly="True" SortExpression="FormID">
<HeaderStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="FormName" HeaderText="Form Name"
SortExpression="Name" >
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Add" SortExpression="Add">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkAdd" runat="server" Checked='<%# IsActive(Eval("Add")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Modify" SortExpression="Modify">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkModify" runat="server" Checked='<%# IsActive(Eval("Modify")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" SortExpression="Delete">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkDelete" runat="server" Checked='<%# IsActive(Eval("Delete")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View" SortExpression="View">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkView" runat="server" Checked='<%# IsActive(Eval("View")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Print" SortExpression="Print">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkPrint" runat="server" Checked='<%# IsActive(Eval("Print")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<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>
Public Shared Function IsActive(ByVal sValue As String) As Boolean
If sValue = "True" Then
Return True
Else
Return False
End If
End Function
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim index As Integer
Dim sCB1Add As String = String.Empty
Dim sCB2Modify As String = String.Empty
Dim sCB3Delete As String = String.Empty
Dim sCB4View As String = String.Empty
Dim sCB5Print As String = String.Empty
For index = 0 To GridView1.Rows.Count - 1
Dim gvRow As GridViewRow = GridView1.Rows(index)
If CType(gvRow.FindControl("chkAdd"), CheckBox).Checked Then
sCB1Add = "1"
Else
sCB1Add = "0"
End If
If CType(gvRow.FindControl("chkModify"), CheckBox).Checked Then
sCB2Modify = "1"
Else
sCB2Modify = "0"
End If
If CType(gvRow.FindControl("chkDelete"), CheckBox).Checked Then
sCB3Delete = "1"
Else
sCB3Delete = "0"
End If
If CType(gvRow.FindControl("chkView"), CheckBox).Checked Then
sCB4View = "1"
Else
sCB4View = "0"
End If
If CType(gvRow.FindControl("chkPrint"), CheckBox).Checked Then
sCB5Print = "1"
Else
sCB5Print = "0"
End If
Next
End Sub
Please help me as I am new for 2005 Version.
Thanks....
|
|
|
|
|
In your btnSave_Click event you can call an update command for each record w/in the loop. Based on which checkbox is selected, call the appropriate update method (INSERT/UPDATE/DELETE).
The other option is to perform each operation (Add, Update, Delete) on a DataTable object, define a DataAdapter object and set the UpdateCommand, InsertCommand and DeleteCommand properties then pass the DataTable to the DataAdapter.Update() method.
|
|
|
|
|
Hi all,
can smbody please give me the codings to create a crystal report in ASP.NET?
I need to extract data to the report from a specified query. How to provide the query to the crystal report??
and how do you display it on the web page, can I use the reportviewer to do that or is there anty other method?
Thanks for any reply!!
|
|
|
|