|
Thanks Richard. I followed the link you suggested but that is not what i want. I know how to add the onitemcommand and how to call it. What i want is, i want to call the onitemcommand event on page load without waiting for click. Below is example of what i want.
Html
<pre><asp: DataList ID="dtl" runat="server" onItemCommand="action"/></pre>
code behind
<pre>Sub action(ByVal obj As Object, ByVal e As DataListEventArgs)
MsgBox("Hello")
End Sub
</pre>
the msg can only show when a button inside datalist is click. How can i make the msg show on page load? Thanks.
|
|
|
|
|
That's never going to work - you're trying to display a message on the server.
If you're lucky, you'll get an exception telling you that the current process is not interactive.
If you're not lucky, the message box will pop up on the server, where nobody will see it, and your page will hang waiting for someone to click the "OK" button.
The code might appear to work when you test it from Visual Studio, but that's only because you're testing it locally, so the server and client are the same machine. As soon as you deploy it to a real server, the code will fail.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Respected sir,
I am student of final year B.Tech.(Information technology).plz suggests me some projects related to application software....
|
|
|
|
|
It is unlikely that we can make a valid suggestion, since we know nothing about you, your interests or experience. Find a subject that interests you and think of some application that would be useful in that field. Even a simple database and reporting system might have some useful application.
|
|
|
|
|
Yes, I am agree with Rechard.
Before making Project see your Interest which you have lots of information about it.. Because less information about your project will not be complete successfully.
|
|
|
|
|
Hi to everybody
premised that I am new of this environment (VISUAL Studio/ASP), I was trying to follow the example at http://www.codeproject.com/Articles/794899/Linking-ASP-NET-MVC-with-DB-Table to this page, but I immediately find a problem during the configuration of the connection; the problem is that when I try of "to insert" the "Provider OLE DB" it doesn't pick up me him, in the sense that, in the list it doesn't make me see nothing and if click on data link i receive the message "reference to an object not planned on an object instance"
If I go on component of. NET Framework sees all the elements that begin with DB2 and iDB2 (DB2Command, DB2Connecction... iDB2Command, iDB2COnnection etc. etc.)
can someone point out me as to resolve this problem?
Thanks in advance
|
|
|
|
|
I really can't answer your question here, but did you check your firewall or network connection to your database server?
If your computer can't see the server, then Visual Studio won't be able to either.
Is your server discoverable? you may have to check your servers firewall as well.
modified 26-Aug-14 16:46pm.
|
|
|
|
|
This is very hard to explain and probably even more difficult to solve. What I am doing is removing all error logging from the MVC controllers into a single log statment in the Global.asax Application_Error event. This is the problem I am faced with. To do this I am using a method like below in a controller I refactored:
try
{
tg.updateUpproverDetails(app.RequestID, reg["RoleId"], reg["ServiceId"], reg["RegionId"], reg["MTFSiteName"]);
ViewBag.RegionId = new SelectList(uRegions, "RegionID", "RegionName", reg["RegionId"]);
ViewBag.ServiceId = new SelectList(uServices, "MTFServiceID", "MTFServiceName", reg["ServiceId"]);
ViewBag.RoleId = new SelectList(uRoles, "ABACUSUserRoleID", "UserRole", reg["RoleId"]);
List<string> mtflist = new List<string>();
string[] yu = reg["MTFSiteName"].Split(',');
if (yu != null)
{
foreach (var x in yu.ToList<string>())
{
mtflist.Add(x);
}
}
ViewBag.MtfId = new MultiSelectList(uMtfs, "MTFSiteID", "MTFSiteName", mtflist);
return View(app);
}
catch (Exception e)
{
e.Data["ErrorMsg"] = "General Unhandled Exception";
e.Data["Location"] = "UpdateUpproverDetails procedure in AdminController";
if (e is DataException)
{
e.Data["ErrorMsg"] = "Data Exception";
e.Data["Location"] = "UpdateUpproverDetails procedure in AdminController";
}
else if (e is NullReferenceException)
{
e.Data["ErrorMsg"] = "Null Reference Exception";
e.Data["Location"] = "UpdateUpproverDetails procedure in AdminController";
}
throw e;
}
As you can see if no exceptions occur then the 'return View(app);' does it post and displays ther view. If however; there is an except it is trapped in a single catch block and re-thrown to the Global.asax Application_Error event for loggin. Now this works.
Now for the problem controller's try/catch block. Below is the following code:
try
{
response = client.GetAsync("Registration?user=" + Username).Result;
responseBodyAsText = response.Content.ReadAsStringAsync().Result;
if (responseBodyAsText.Equals("true"))
{
usercred.Newpassword = "";
usercred.Currentpassword = Password;
usercred.Username = Username;
return View("Change", usercred);
}
else
{
/////LOGIN USER
string passurl = System.Web.HttpUtility.UrlEncode(Password);
response = client.GetAsync("Registration?username=" + Username + "&password=" + passurl + "&edi=" + "" + "&isEdi=" + false).Result;
responseBodyAsText = response.Content.ReadAsStringAsync().Result;
statuses = JObject.Parse(responseBodyAsText);
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(UserCred));
using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(statuses.ToString())))
{
usercred = (UserCred)serializer.ReadObject(ms);
}
}
}
catch (ArgumentOutOfRangeException e)
{
ViewBag.result = "NotAuthenticated";
log.Info("The size specified is less than or equal to zero. Login/Password for user failed " + e.ToString());
return View("Index");
}
catch (ObjectDisposedException e)
{
ViewBag.result = "NotAuthenticated";
log.Info("The current instance has been disposed. Login/Password for user failed " + e.ToString());
return View("Index");
}
catch (InvalidOperationException e)
{
ViewBag.result = "NotAuthenticated";
log.Info("An operation has already been started on the current instance. Login/Password for user failed " + e.ToString());
return View("Index");
}
catch (ArgumentNullException e)
{
ViewBag.result = "NotAuthenticated";
log.Info("Login/Password for user failed " + e.ToString());
return View("Index");
}
catch (Exception e)
{
ViewBag.result = "NotAuthenticated";
log.Info("Login/Password for user failed " + e.ToString());
throw;
}
}
Session["userData"] = usercred;
Session.Add("Authenticated", "True");
return RedirectToAction("Index", "Home", usercred);
}
Here you can see that in each catch statment the logging is done, not in the Application_Error event, but in the catch statment itself. Also in each catch statment a specific 'return View("Index");' is called and a return RedirectToAction("Index, "Home") is called at the bottom.
I tried the following and the exception is never thrown. Can anyone help?
catch (Exception e)
{
ViewBag.result = "NotAuthenticated";
return View("Index")
throw e;
}
Session["userData"] = usercred;
Session.Add("Authenticated", "True");
return RedirectToAction("Index", "Home", usercred);
}
}
|
|
|
|
|
The problem is in the order of your code
catch (Exception e)
{
ViewBag.result = "NotAuthenticated";
return View("Index");
throw e;
}
Change to this: (for testing purposes only)
catch (Exception e)
{
ViewBag.result = "NotAuthenticated";
throw e;
return View("Index");
}
|
|
|
|
|
Hello everybody, how is the day going? I was over looking this to be a simple task but after involving my self, i found is not easy. I'm working on chat application and I'm done with the group chat. Now I want to implement private chat between two particular users. That is, John and Patel can chat privately in the private chat window and this is where am stuck. I need the technique to achieve this. I am not using signalR either ling to sql. Am using stored procedure. Any way to play around this please e.g sample code, steps, or videos.
|
|
|
|
|
Why you don't want to use SignalR? I think it is the good fit for your need. You may get sample application also on internet.
Otherwise, you may consider the older approach like long polling but you may need to do some hard work for it.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Good day everybody! Please, I need your help in this stuff. How can i reset the id column in sql database which has auto increment property, to restart from 1 after hitting the delete button using asp.net and vb as code behind. I used the truncate statement but I didn't like this idea because everything was deleted. I specified the number of records to be deleted using the top statement with the delete statement.
|
|
|
|
|
This is a repost and you were answered on how to do it.
However, this sounds like an absolute terrible idea. You say you just deleted some records and now want to reseed the identity field? Bad, bad idea. Do not do it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
First of all, it is Asp.Net forum. You should post your question to the right forum.
Secondly, it is not a good idea to reset identity column in a live application. Consider using Guid instead of Identity column.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Good day everybody! Please, I need your help in this stuff. How can i reset the id column in sql database which has auto increment, to restart from 1 after hitting the delete button using asp.net and vb as code behind. I used th truncate statement but I didn't like this idea because I specified the number of records to be deleted using the top statement.
|
|
|
|
|
|
If you feel the need to do that, then maybe you don't understand IDs.
|
|
|
|
|
Good Day All
i have an asp.net 4.5 application. i have hosted it on IIS 7.5 in Windows Server 2008. My application has different folders within it and some are for JS and some are for CSS and etc.. and they are inside a directory named "Shared" in my problem and most of the things especially the css , images etc they are reference like this
<link href="../Shared/assets/css/bootstrap.css" rel="stylesheet"/>
<link rel="apple-touch-icon" sizes="57x57" href="../Shared/assets/ico/apple-touch-icon-57x57.png">
now when i host this Project i have issues with CSS and images because they are not retrieved. i use Fiddler to check what is happening and i realised that after i hosted the application now Fiddler reports a 404 error on the following path
http://myiisreserver/Shared/assets/css/bootstrap.css
there are many of them , this is just an Example. now you can see it it can see the server , but instead of adding my Application or website name , it add the Directory within my application. So basically it should look like this
http://myiisreserver/MyWebapplication/Shared/assets/css/bootstrap.css
What could be the Problem.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
The problem is you are using relative urls by using the ../ notation and now that you have deployed it your root appears to be different. You may just have IIS setup wrong as far as what an application is or you may need to change your links.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
The double dots means go back 1 folder level
So if your root is /
and your calling webpage is /about/default.aspx then the double dots apply ../images/header.jpg
If your root is /
and your calling webpage is /default.aspx, the the double dots don't apply /images/header.jpg
Best thing is to take out the dots, and test, to make sure it has nothing to do with the dots first, like the previous post says, confirm your web server is setup right. Then think about the dots when your web app works.
In my beginning, I didn't use the dots, but started using the dots after running test on them and seeing how they actually work.
[EDIT]
Here is some information on the history or use of the double dots so that you can better understand the meaning in various operating systems and URL's
http://en.wikipedia.org/wiki/Path_%28computing%29[^]
This Link is pretty good here
http://teaching.idallen.com/cst8207/12f/notes/160_pathnames.html[^]
I think this one fits the bill here
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//005700000009000000.htm[^]
modified 21-Aug-14 15:47pm.
|
|
|
|
|
Thanks for your reply . the funny thing is that i hosted this same deployment in the Paid Domain and it works, So now what i did i created another website in IIS at the Level of "Default" website and i change the Default website port to 8083 so it does not conflict with my other website and i changed the new website to use port 80 and run the site with the ../share path and it worked. it buffles me.
When i used Fiddler , i see it was expecting my website to be in wwwroot folder but when i setup the web application in IIS the virtual Directory was in another drive. so i moved also the files to wwwroot.
Thanks again
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
When I encode a website or web application, I always assume that the root of the project is /
So everything is based off of /
Not sure if I can offer any help or insight on this, I went through that a decade ago, and have always used a systematic way of setting up servers and projects since then.
When I setup a website in IIS, I don't use the default IIS folder, I set everything up on a drive letter like Z
Z:\internet
We use an independent disk drive for websites, which is solid state.
In IIS, We set the Physical Path to let's say
Z:\internet\artisan-plaster.com
Z:\internet\website.com
Right Click website-> Manage Website -> Advanced Settings -> Physical Path
And then run our power shell or just cmd security scripts to that individual physical locations above to set IIS Anonymous and App Pool security for the folders in the project, and RW/RO folder attributes.
|
|
|
|
|
Its ok , everyone needs help at some point. for now my issue is resolved
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Could you help me.. I need function to compare 2 string and print (show) the difference between 2
|
|
|
|