|
Thanks
I need the actual count in the background server code which must use the web form to get paramenters, etc.
How does the above fit in with the existing code? Do I remove it? or is this is combination with it?
|
|
|
|
|
It depends what your gettable method is doing. I suspect you're trying to push html to the client which asp.net doesn't really support, the page has to be made in one go then sent to the client in one go, you can't do it in chunks (you can look at disabling buffering though, it might work, Response.Buffer = false).
Chances are you're going to have to re-architect this and rather than generating the table in a background thread, have your javascript function keep calling a web method that returns the data 10 or 50 rows at a time then create the table html via javascript as each batch comes back. That way the page stays responsive and gradually loads. Doing it the other way and trying to write the table bit by bit might not work.
Google for retrieving data via ajax, and building a table via ajax, you should get sample code of both.
|
|
|
|
|
I understand that normally you get a server request and one page goes out and that is what I was really hoping to get around somehow.
GetTable does just that. It gets a database table from a Web Service based on form controls and populates a grid. It also writes it to disk for potential downloads.
I was hoping that this technology to update the lblMsg status could be used in other programs for a bunch of similar things.
Putting in some java to keep requesting a chunk might work in this case but in our other programs it would not or at least not easily. In the other programs the code would be much more complex and could not be done in chunks since the processing id dependent upon what it did in the records prior.
My thought is that since there are push technologies out there i.e. Chats do not need a user to push a button to get what other people enter, same for streaming that there must be a way of doing the same in my simple case. I have read about keeping sessions opened, etc. but since I am not a web developer I have a hard time getting my head around it.
As an alternative I was thinking of changing the lblMsg.text to s variable lblMsg_text that perhaps the async methods could just use to populate the real lblMsg.txt via Java. Would there be a way for that to work. I would have to be an instantiated variable since multiple users could be using it.
modified 26-Mar-15 8:58am.
|
|
|
|
|
I don't how you came up with that code, and it sort of looks like your a windows programmer trying to write a web form.
In code block 1, not sure why your using sleep, you sort of want the code to run as fast as possible.
In code block 2, you have a weird mixture of JQuery and Javascript.
So I just figured out that you just want to show a progress image or something, or you just want to call the service and create a pause as if code is running or something.
To show a progress, you just make a modal overlay using div, and just show and hide it using the client script.
This is how client script via web service works,
Introduction to using jQuery with Web Services[^]
|
|
|
|
|
I am not a web developer so please bear with me.
1. Sleep used to simulate long running process getting records from a large database from a web service and processing same in the server.
2. The java stuff was done by a developer that I hired who could not do what was needed. He is now gone.
3. I want to push the status / progress which may take 5-10 minutes and I want the user to see the progress i.e. Doing Record#=nn, Added=nn, etc.
4. I am happy with keeping the div showing all the time but the problem is that normally the web page does not get updated until the process is finished. For a long running process the user will give up after a minute unless he sees a change.
5. I am not sure what a modal div is but seems to imply that things wait until the modal div has completed something or the user hit a button. This is NOT what is needed.
|
|
|
|
|
Oh, I thought you were a programmer, I apologize for the mistake.
As far as the progress goes, just depends on the UI design.
I've been ditching the Modal Progress lately, for just swapping out the data input container for a progress container and then switching to a result container all in the same space. Sort of like tabs but with no tabs.
Pushing the status to the progress container would be tricky. I'm trying to think of a way to do that.
I guess I would write jquery to send data in small chunks, and display the results of that chunk, in a loop format.
Sounds like you need some help in programming.
|
|
|
|
|
I am a programmer but not for web apps. 40+ years of programming. I am not family with jQuery and have very basic Java knowledge.
Need the techniques to be used.
In vb.Net windows desktop you can bring up a modal screen or MessageBox but that stops everything. I do not want the progress indication to stop anything.
The problem is not switching visible to invisible div's or controls but getting the data from / to controls and the 'running' form.
I am not trying to populate the grid in periodically but the progress i.e. lblMsg.text = "Doing Record#=nnn"
|
|
|
|
|
I make windows applications, so I know that the messagebox stops the message pump running in the Windows OS.
The thing here is, your working with HTTP protocol, and you have to obey the rules of it.
On top of that, your working with HTML, which are elements, and not objects, sorry for the correction.
So with the HTTP protocol, it's pretty much get and post, get a page, post a page back to the server.
It would be a waste of time to keep submitting the form back for each piece of data transmitted, to show detailed progress.
So you use a client script, that runs on the browser, to transmit each piece of data in the background, and change the DOM.
The DOM is the collection of HTML that is downloaded from the server making up a web page.
You can alter the HTML elements, delete, append, change text by manipulating the DOM using Javascript or JQuery.
A working example here, that switches address input to progress, fetches the address, populates the textboxes, switches back to address input.
I would experiment, or just write code that gets each line of data on your form, and run the AJAX call to web service in a loop, creating new HTML for each record processed. So instead a progress, they just see the data uploading, and new HTML records created.
This would fool or give the illusion of progress, without having a bar or wheel. I suppose a fake progress sort of message box could be made with an HTML div that expands in witdh, colored green or blue.
If you look at my Tip, I wrote a filmstrip that just loops, until the end is reached. The same principal could apply for your solution, in which 1 function just calls another function, until the end is reached.
The primary function collects the data, the child function posts the data, and prints a result.
If you need help on this, you can private message me.
Display Advertising Filmstrip[^]
function Selected_Shipping_Address_Load(m_Data1) {
var panel_CardInfo = $('[id*="_panel_MP_CardInfo_Container"]');
var panel_Progress = $('[id*="_panel_MP_Progress_Container"]');
if (panel_CardInfo.css('display') === 'inline-block') {
panel_CardInfo.css('display', 'none');
panel_Progress.css('display', 'inline-block');
}
else {
panel_CardInfo.css('display', 'none');
panel_Progress.css('display', 'inline-block');
}
var m_secureToken = $('[id*="_txt_Secure_Token_Field"]').val();
var m_localization = parseInt($('[id*="_txt_Localization_Field"]').val());
var send_Data =
"{" +
"\"m_Data1\" : \"" + m_Data1 + "\", " +
"\"m_Localization\" : " + m_localization + "," +
"\"m_secureToken\" : \"" + m_secureToken + "\" " +
"}";
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "MakePayment.asmx/load_ShippingAddress",
data: send_Data,
dataType: "json",
error: function (xhr, status, error) {
exitCode = 2;
alert(xhr.responseText);
},
success: function (responseText) {
var objB = jQuery.parseJSON(responseText.d);
exitCode = objB.exit_Code;
if (exitCode > 0) {
alert('Error Occured');
}
else {
var address_ID = objB.address_ID;
var address_Attention = unescape(objB.address_Attention.replace(/\+/g, " "));
var address_CompanyName = unescape(objB.address_CompanyName.replace(/\+/g, " "));
var address_Streetline1 = unescape(objB.address_Streetline1.replace(/\+/g, " "));
var address_Streetline2 = unescape(objB.address_Streetline2.replace(/\+/g, " "));
var address_City = unescape(objB.address_City.replace(/\+/g, " "));
var address_State = unescape(objB.address_State.replace(/\+/g, " "));
var address_Postal = unescape(objB.address_Postal.replace(/\+/g, " "));
var address_Country = unescape(objB.address_Country.replace(/\+/g, " "));
var address_Phone = unescape(objB.address_Phone.replace(/\+/g, " "));
var address_Residental = objB.address_Residential;
var address_ShippingIsBilling = objB.address_ShippingIsBilling;
$('[id*="_txt_MP_CompanyName_Field"]').val(address_CompanyName);
$('[id*="_txt_MP_StreetAddress1_Field"]').val(address_Streetline1);
$('[id*="_txt_MP_StreetAddress2_Field"]').val(address_Streetline2);
$('[id*="_txt_MP_City_Field"]').val(address_City);
$('[id*="_ddl_MP_CountryCode_Field"]').val(address_Country);
switch (address_Country) {
case 'US':
load_States_US(address_State);
break;
case 'CA':
load_States_CA(address_State);
break;
case 'MX':
load_States_CA(address_State);
break;
}
$('[id*="_ddl_MP_StateCode_Field"]').val(address_State);
$('[id*="_txt_MP_PostalCode_Field"]').val(address_Postal);
$('[id*="_txt_MP_Phone_Field"]').val(address_Phone);
panel_Progress.css('display', 'none');
panel_CardInfo.css('display', 'inline-block');
}
}
});
}
|
|
|
|
|
Thanks let me play with that technique.
|
|
|
|
|
Requirement: textbox limit: 25characters, max limit:40char allow
IF text contains {State},count for {State} only is 16,
{City} count 14, {St}=2,{Zip}=5
Problem:
I have written JQuery code for this (below code) but it accepts
1.25chars={City}123456789—correct
2.25charcters=1234567891245678{City}-wrong- but it also accepting this one
3.25-chareacters=123456789123456789{City}---wrong- but it also accepting this one
1 dropdown:MainContent_ddlSelectAdLine Options: HeadLine
1 Textbox: MainContent_txtAdline onkeyup=”
<input name="ctl00$MainContent$txtAdline" type="text" id="MainContent_txtAdline" onkeyup="getBatch(event);" style="border-style:Inset;width:85%;" maxlength="50">
1 Span: MainContent_lblCount—for charcters Counting
50
Jquery Code:
function getBatch(e) {
debugger;
var len=0;
var cnt = $("#MainContent_txtAdline").val();
var count = $("#MainContent_txtAdline").val().length;
if (cnt.indexOf("{City}") > -1)
{len = 16;$("#MainContent_lblCount").html(16);count = count-6+len}
else if (cnt.indexOf("{State}") > -1) { len = 14; count = count - 7 + len }
else if (cnt.indexOf("{St}") > -1) { len = 2; count = count - 4 + len }
else if(cnt.indexOf("{Zip}")>-1){len=5; count=count-5+len}
else { len = 0; count=count+len}
if (count <= 0) {
count = 0;
}
var ddlslectedText = $("#MainContent_ddlSelectAdLine option:selected").text();
if (ddlslectedText == "HeadLine") {
if (cnt.indexOf("{City}") > -1)
{ $("#MainContent_txtAdline").attr('maxlength', '30'); }
else if (cnt.indexOf("{State}") > -1)
{ $("#MainContent_txtAdline").attr('maxlength', '30'); }
else if (cnt.indexOf("{St}") > -1)
{ $("#MainContent_txtAdline").attr('maxlength', '30'); }
else if (cnt.indexOf("{Zip}") > -1)
{ $("#MainContent_txtAdline").attr('maxlength', '40'); }
else { $("#MainContent_txtAdline").attr('maxlength', '40'); }
if (count > 25) {
$("#MainContent_lblCount").html(count).css('color', '#CC0000');
}
else { $("#MainContent_lblCount").html(count).css('color', '#000000'); }
}
}
|
|
|
|
|
Procedure or function 'listdtlsearch' expects parameter '@name', which was not supplied.
|
|
|
|
|
|
It's fairly self-explanatory. You need to supply the procedure with a parameter. Exactly how you do this depends on how you are calling the code, which we don't know as you didn't paste your code.
|
|
|
|
|
The error should be clear. However, what happens sometimes is someone has code like this:
cmd.Parameters.AddWithValue("@name", name);
and if the name variable is null you'll get that error. If name is null then you need to supply DBNull.Value instead.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi try following
1 check name in procedure and in code behind should be same
2 or check procedure name
i think it is typo error
|
|
|
|
|
my web page in table is create but update and delete functionality is not worked.......to plz help me
my html table
<div class="outer">
<div class="inner">
<div class="page-header"><!-- Page header -->
<h5><i class="font-home"></i>Data Display</h5>
<ul class="icons">
<li><a href="#" class="hovertip" title="My tasks"><i class="font-tasks"></i></a></li>
<li><a href="#" class="hovertip" title="Reload data"><i class="font-refresh"></i></a></li>
<li><a href="#" class="hovertip" title="Settings"><i class="font-cog"></i></a></li>
</ul>
</div><!-- /page header -->
<div class="body" >
<div class="block well">
<div class="table-overflow">
<table class="table table-striped" id="data-table">
<thead>
<tr>
<th>Id</th>
<th>State Name</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
asp.net code
public void DataLoad()
{
DataSet ds = obj.gd("select * from state where adminid='" + Session["idd"] + "'");
for (int i = 0; i < ds.Tables[0].Rows.Count;i++ )
{
htmlTable.Append("<tr>");
htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["id"] + "</td>");
htmlTable.Append("<td>" + ds.Tables[0].Rows[i]["state"] + "</td>");
htmlTable.Append("<td>" + "<a href='#'> <i class='icon-pencil' /> </i></a>" + "</td>");
htmlTable.Append("<td>" + "<a href='#'> <i class='icon-remove' /> </i></a>" + "</td>");
htmlTable.Append("</tr>");
}
PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });
}
|
|
|
|
|
use jquery
Help people,so poeple can help you.
|
|
|
|
|
Hi Developers,
Hope everybody doing well ..
I'm trying to work with ASP.net membership also integrated with my APP,
first I've created a sample web app to create the new users to membership table
I've Added the membership tag to web.config and change the connection string to my Database connString also I set ApplicationName to "\".
then I added "CreateUserWizard" control with the following code:
Membership.CreateUser(CreateUserWizard1.UserName,CreateUserWizard1.Password,CreateUserWizard1.Email);
But when I run the code, I have the following exception :
http://www.m5zn.com/newuploads/2015/03/21/jpg//9a5f11556559e6b.jpg[^]
Anyone help please
|
|
|
|
|
The column it's referring to isn't referenced in the line of code you provided. May need more code in order to help. Something is referencing the ApplicationName column, and it doesn't exist in the database.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I want to display the name of the user that is currently logged on in the system.
PS:- Using VS-2013, ASP.NET and I am freshers so please be specific Don't have much idea about authorization, identity or authentication.
Thank You
|
|
|
|
|
Then the better thing would be to first go and learn ASP.NET's authentication modules, or the framework being used. You might be using Identity; or a WebSecurity -based method of authentication which can be answered by the way you create your application -- as a new project or a new website.
If that is the WebSecurity [^]-based application (a website), then you can do that like this,
var username = WebSecurity.CurrentUserName;
Or you can get the UserId of the user and query the database to get the Name.
Otherwise, if you're using Identity[^], then you would have to query the database anyway; Entity Framework has got you covered!
You can get the values from the database as,
db.Users.FirstOrDefault(x => x.Id == someUserId);
You can then move on and learn other basics about ASP.NET from MSDN, or the best option. Test, try and solve method!
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I attended an Interview last sunday. One of my interview question is,
"Why the validation in Update Panel is not working properly in Asp.net? And what is the reason?"
I tried some reference article in Google but not yet cleared due to some language problem. Can anyone tell me the reason? or please provide some source to clear my question.
Hope my question is clear as well.Dunno where should i post this? If my question is not here in a right forum, please guide me to correct session.
Regards,
Rajeshwaran
~R@JEES#
|
|
|
|
|
Given the detail you've supplied the only answer I could give is "Because it hasn't been coded properly".
|
|
|
|
|
Yes i too have the same answer. But, little bit confusion when he asked this question to me. Because having less knowledge about Validation in Update panel. He asked me why it's not working properly? there i struck.
~R@JEES#
|
|
|
|
|
How to check that textbox data entered by the user exist on the db(MS Access) or not and if it exist in db than on the basis of that fetch the data and display on gridview else show error msg on label.
Note:- Using VS-2013 Asp.net webform with c#
|
|
|
|
|