|
dfffffffffffffffffffffffffffff
|
|
|
|
|
Hello,
There is a website that has some input boxes and after you enter the input you press a button and an answer shows up.
1) I am pretty sure that the website is in ASP, how can I be sure?
2) I want to make a windows application that behaves like the website, for the user it will have a specific MMI and to the internet it shell behave like I am working in the browser.
can anyone please give me a starting point?
Thanks
|
|
|
|
|
Look at the URL of that website: does it end with ".asp" or ".aspx"? Then it is an asp application. What you describe could also be achieved with JavaScript in an otherwise static html page, and of course you could do it also with php, cgi scripting, and other methods.
|
|
|
|
|
this is my code
<asp:Label ID="Label7" runat="server" BorderStyle="None" Width="80px" Text="Thumb URL" />
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" Filebytes='<%# Bind("thumbnail") %>' />
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" Display="Dynamic" ControlToValidate="FileUpload1" ErrorMessage="Required" /><br />
<asp:Label ID="Label8" runat="server" BorderStyle="None" Width="80px" Text="Image URL" />
<asp:FileUpload ID="FileUpload2" runat="server" Width="200px" Filebytes='<%# Bind("image") %>' /> /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" Display="Dynamic" ControlToValidate="FileUpload2" ErrorMessage="Required" /><br /><br />
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</EditItemTemplate>
|
|
|
|
|
I don't think that is legal with the Bind, I haven't used the FileUpload webform object in years, just from Code, FileBytes is a code property to get the total size of the upload on the server side.
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" Filebytes='<%# Bind("thumbnail") %>' />
<asp:FileUpload ID="FileUpload1" runat="server" Width="200px" />
|
|
|
|
|
Try removing the snippet Filebytes='<%# Bind("thumbnail") %>' from .aspx page and put it at .aspx.cs file where you are checking for the File Upload control has file or not..!
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
That's not going to work, Filebytes get the file uploaded as a stream or array of bytes, so you can write it as a blob, or do a direct write to the disk drive, or pass the stream to another server.
Gets an array of the bytes in a file that is specified by using a FileUpload control.
It's the other way around
Dim Input(fileLen - 1) As Byte
Input = FileUpload1.FileBytes
|
|
|
|
|
Hi,
I have listbox wich is dynamically updated with an AJAX call the declaration of the controls
<asp:DropDownList ID="lb_Retour" name="drp_Retour" runat="server">
</asp:DropDownList>
<asp:ListBox SelectionMode="Multiple" Height="160px" Width="300px" ID="lb_Info"
runat="server"></asp:ListBox>
In code behind i'm binding dropdownlist to datasource and adding OnChange Event to make an AJAX call with the function getvalues
protected void Page_Load(object sender, EventArgs e)
{
lb_Retour.DataSource = Ctx.Retours.OrderBy(n => n.Id).Select(n => n);
lb_Retour.DataTextField = "Retour";
lb_Retour.DataValueField = "Id";
lb_Retour.DataBind();
lb_Retour.Items.Insert(0, new ListItem("-Selectionner-", "0"));
lb_Retour.Attributes["onchange"] = "getValues(this);";
}
The javascript wich update the listbox values depending on dropdowlist selection
<script type="text/javascript">
function getValues(Control) {
var Code = Control.value;
if (Control.value.trim() != "")
$.ajax({
type: "POST",
url: "../Services/DomaineService.asmx/GetResponse",
data: "{ 'typeId': '" + Code + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});
}
function OnSuccess(data, status) {
$('#ctl00_ContentPlaceHolder1_lb_Info').children().remove();
$('#ctl00_ContentPlaceHolder1_lb_Info').append(data.d.ValueList);
}
function OnError(request, status, error) {
alert(error.toString());
}
<script>
The data that returns the webservice is
<option value="1">toto</option><option value="2">titi</option><option value="3">tata</option>
below the Webservice Code
[WebMethod]
public ResponseInfo GetResponse(string typeId)
{
ResponseInfo xResponse = new ResponseInfo();
xResponse.ValueList ="";
PDataContext Ctx = new PDataContext();
var query = (from objInfo in Ctx.Infos
where objInfo.Type == Convert.ToInt32(typeId)
select objInfo
);
foreach (InfoComplementaire item in query.ToList())
{
xResponse.ValueList +="<option value=\""+item.Id.ToString()+"\">"+item.InfoComplementaire1.ToString()+"</option>";
}
return xResponse;
}
Well everthing is ok the values are update depending on selected on the dropdownlist the probem is when i try to select item in the list box in code behind i get nothing at all item.Selected is always false when the option values comes from the AJAX call!!
Thank you for help
|
|
|
|
|
That would be onClientClick to run javasccript before the page submits a postback
papy-boom wrote: The data that returns the webservice is
<option value="1">toto</option><option value="2">titi</option><option value="3">tata</option>
That's because you didn't include the selected attribute in the option tag when you wrote the new value in javascript.
Also, according to .net law, you can't populate a listbox or dropdown box in code behind, or from the server, and delete the values with javascript, and send the new selected value back to the server on postback, because the server has a temp list of the values it sent to the browser the first time, and it won't match the list on the postback.
You'll get nothing selected, because the original values are gone.
If your going to use javascript to populate the values via web service, you have to use an empty box, populate it, get the selection, send it back via web service,
|
|
|
|
|
Try by putting AutoPostBack property of DropDownlist set to "True"
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
I almost said that as well,
but you can't autopostback to the server if you use javascript / JQuery to wipe out the original list and create a new list from a web service, because the server retains the values it sent the first time, and expects one of those values to be selected.
If the value is not present, it will trigger a tamper or fraud error.
|
|
|
|
|
Hi,
I have a background image for my web page, that I have assigned in the load even the code behind.
Image is visible in the web page but that image in not printing when I print it. Can anybody please help me in resovling this issue pls.
Its little bit urgent. Thanks in advance.
In desing mode in html part Webpage
<body runat="server" id="rcbody">
<form id="form1" runat="server">
-------------------------
--------------------------
</form>
</body>
In the load event in the code behind is as in the below
if (Request.QueryString["status"] == "Cancelled")
{
rcbody.Attributes["style"] = "background-image:url('../images/Cancelled_WM.jpg');";
}
else if (Request.QueryString["status"] == "Replaced")
{
rcbody.Attributes["style"] = "background-image:url('../images/Replaced_WM.jpg');";
}
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
First of all I would say don't do this. You should be using CSS rather than hard coding style in your code. You can change the image by applying different classes to the element on the client. You can also make use to CSS media type, @print, to control how the page is rendered when printing.
Failure is not an option; it's the default selection.
|
|
|
|
|
Hi,
We have to select the image depending upon query string, is it possible. Now I found that the image is not set even for the page itself. First it needs to be set for the page then it should print on the printer.
And then it should come in the render to pdf.
Any help please, thanks in advance, its little bit urgent please. Any link or any code snippet helps a lot. In the mean time I will be googling.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
If you aren't seeing the image, then chances are that your path is wrong. Don't rely on relative pathing such as ../ to get to a resource. Always go from a known root to the resource - that way, you can assure yourself that you get to the resource from whereever you are in the site.
|
|
|
|
|
Yes, thanks fixed
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
No problem. It's always the simple little things that catch us out.
|
|
|
|
|
Hi,
Now I am unable to print the background image in the body tag or div tag that i have put. I tried in both body and div tags by putting the background image. It is showing but unfortunately its not printing.
Any help me please, its urgent and I am struck in all the ways.
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
indian143 wrote: We have to select the image depending upon query string, is it possible
You should research themes. Now, if the images changes or the path to it needs updated you need to fix the code, recompile, deploy and recycle the worker process, rather than update a CSS file.
indian143 wrote: its little bit urgent please
So how is your poor design and understanding reason for me, or anyone, to rush a response to you?
Failure is not an option; it's the default selection.
|
|
|
|
|
In HttpWebRequest a user can pass Method as Post OR Get OR Put OR DELETE etc.
But for our specific project I need to pass HttpMethod as "POST /api/login HTTP/1.0".
But this is not allowed in .NET CF.
Then can any one tell me workaround for this please for customizing Http Method.
Thanks in advance.
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi
-- modified 23-Apr-12 7:39am.
|
|
|
|
|
Are you talking to a web service that requires a login first, before you transmit xml?
|
|
|
|
|
Anyone pls help,
i designed and tested my ASP.Net page locally with the Visual Studio built in test server and it worked fine, but when i hosted it, it gave me this error:
Runtime Error
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
And also:
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Even with me modifying the code as the error message said it's still the same,
pls help.
|
|
|
|
|
1. Please don't repost the same question[^].
2. Explain what error you receive; we cannot guess what it may be.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Not all the references (ddls) are hosted on the server. Make sure that you have deployed all the dlls and .net version is matching with development version.
|
|
|
|
|
Set CustomError Mode To ON instead of OFF, by this you can getexcat problem.
- Happy Coding -
Vishal Vashishta
|
|
|
|