|
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
|
|
|
|
|
Hello friends,
I need to fill all employee of all department in dropdown.Employee list should be diplayed in grouping as per deparment and heading of the department should be displayed.
so Is there any free available dropdown control having grouping functionality.
pls reply.Thanks in advance..
|
|
|
|
|
|
I need to know what is repository classes? how can i use them in ASP.NET Web forms and MVC?
|
|
|
|
|
|
Anyone pls help with this problem, i built an asp page and uplaoaded it but i'm getting the following error:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
And also:
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Pls help.
Thnx
|
|
|
|
|
fire_hawk wrote: i built an asp page and uplaoaded it but i'm getting the following error:
And the error would be...?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|