|
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!!
|
|
|
|
|
Hi there.
i want to show pop up box on any event i have selected from d dropdown menu.please reply me by my mail id or here itself.
nimal_8@yahoo.com
Regards
Neemal Shah
|
|
|
|
|
Use Javascript to handle the onclick event. You should have no difficulty finding resources here [^]
only two letters away from being an asset
|
|
|
|
|
hi i m mayur
you can write javascript onchange event on bropdownlist
in javascript you can show hide panel or div
like
document.getElementById('rfvleavingdate').style.display = 'block';
document.getElementById('rfvleavingtype').style.display = 'none';
|
|
|
|
|
Hi, now i my ISP's smtp server and it is "maltanet.net". Now for some reason, from the localhost it is being sent fast and the email is being sent for REAL. but when i am uploading the website on the server, the email will be sent very long (very slow) and the email is not being send! why is this?
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Check the SMTP server of the server machine where you uploaded...
|
|
|
|
|
Thanks very much bro!! it worked 100% because the problem that i was doing, is that i was using the smtp of the web server on my localhost and it was firing back an error about spamming. then when i uploaded the asp files, they worked well with the smtp of the web server!!
Thanks again!!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
You are most welcome...
|
|
|
|
|
Hi! Does anyone know how the following files encircled in red were added into the project?(see image from link)
http://img.photobucket.com/albums/v247/diorelle/cultures.jpg[^]
There isn't any template for it when I try to add a new item into the solution, plus the item doesn't go under the Global.asax file... I wanted to add a new resource file for another language...
Thanks so much!
|
|
|
|
|
You can add the language-specific resource file as you would with a normal file, then you need to open the project file and add the DependentUpon attribute for the File entry of this resource file. You can see the File entry of the Global.asax.resx in the project file as an example.
|
|
|
|