|
Hi
Does anyone know where I can find examples and/or explanations on how to implement Structure Maps/Dependency Injection in C#? I have tried finding examples on the Internet, but what I found was not very good.
|
|
|
|
|
|
Yes, I already found that one too, but it doesn't go into the level of detail I want. I am looking for a worked example with explanation that I can use.
|
|
|
|
|
hi,
i tried to use check box in asp.net. well when i run the program, i checked the checkbox but when it process, it is taking checkbox as unchecked. Why this happens ? How to avoid this ?
suchita
|
|
|
|
|
You are surely doing something wrong.
Have a look here with lots of sample examples: CheckBox Class[^]
|
|
|
|
|
SayamiSuchi wrote: well when i run the program, i checked the checkbox but when it process, it is taking checkbox as unchecked.
I can't understand what you post. Explain little more clearly.
|
|
|
|
|
Are you assigning the value of the checkbox outside of an if(!IsPostBack) statement? If so your view state value is being wiped. If you are using DataBinding, make sure your DataBind call is wrapped inside of an if(!IsPostBack) as well.
|
|
|
|
|
i am using that in the button click event.. will if(!IsPostback) be used in that event ?
suchita
|
|
|
|
|
is the checkbox's enableViewState false?
|
|
|
|
|
Hi Suchita,
Please ensure that to put IsPostback condition in page load event.when u call button click event, it'll be postback to the same page and page load then button click events fires. so check it and keep the condition.
Rajendra Prasad Panchati
.Net/Sharepoint Software Engineer.
Hyderabad.
|
|
|
|
|
thanks all so much..it worked now..
suchita
|
|
|
|
|
Hi All,
In my website there is facility that user can send mail using it own email SMTP setting. some user is sending mail success fully but some facing problem for this there is option in config page in which user have to enter his SMTP setting. And also there is test button when users press a test button and if any wrong entry (username, password, smtpServer) then I want to show pop message accordingly.
Is any way in which we can identified that what is wrong entry (username, password or mail server) because I want to give message like "wrong username or wrong SMTP server?
Thanks
|
|
|
|
|
There isn't really anyway to check. For instance, in a hosting environment two SMTP servers could be 10.54.16.10 and 10.54.16.20. If they enter the former when they should using the latter, how can tell the difference? It is a valid address, just the not the correct one for them.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Send a test message and catch SmtpException and check the SmtpStatusCode.
|
|
|
|
|
Hi Samarjeet,
If you give wrong server entry, however It'll give an error like "Relay access denied on 5.7.xx" like that and if u give a wrong credentials it'll throw an error like "Could not connect to the host...". From these errors you can show your custom message to the user. I hope u understand it .
Rajendra Prasad Panchati
.Net/Sharepoint Software Enginner,
Hyderabad.
|
|
|
|
|
Hi,
firstly, sorry if I post it for 2nd times. because its a week I stuck in this problem
I am trying to build up my knowledge regarding ASP.Net and new things which I read from books. Frankly, its few days I got this error. after running my code I see this error
<br />
No matching bindings are available, and the type is not self-bindable. Activation path: 2) Injection of dependency CommunityUserRepository into parameter _rep of constructor of type AccountController 1) Request for AccountController <br />
it is the source code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ninject.Core;
using SportsStore;
using SportsStore.WebUI.Controllers;
using System.Web.Routing;
using Ninject.Modules;
using Ninject.Core.Modules;
using SportsStore.Domain.Abstract;
using System.Configuration;
using SportsStore.Domain.Concrete;
namespace SportsStore.WebUI.Infrastructure
{
public class NinjectControllerFactory : DefaultControllerFactory
{
private IKernel Kernel = new StandardKernel(new SportsStoreServices());
protected override IController GetControllerInstance(RequestContext context,Type controllerType)
{
return controllerType == null ? null
: (IController)Kernel.Get(controllerType);
}
private class SportsStoreServices : StandardModule
{
public override void Load()
{
Bind<IProductRepository>().To<SqlProductRepository>().WithConstructorArgument
("connectionString", ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString);
}
}
}
}
error occure in this line
<br />
protected override IController GetControllerInstance(RequestContext context,Type controllerType)<br />
{<br />
return controllerType == null ? null<br />
: (IController)Kernel.Get(controllerType); <br />
<br />
Could you please help me?
|
|
|
|
|
Hi there, i'm no ninject expert im afraid - only did one mvp-windows-mobile project with it -
so this may not be an answer..
..but obviously, the ninject kernel cannot inject CommunityUserRepository while creating the
controller instance. This usually means that no corresponding mapping has been loaded into the
kernel inside "Load". So maybe, you have to include a mapping for CommunityUserRepository in the kernels load-method. Also, the constructor parameter "xyRepository" of your controller should maybe
be an interface.
(There may be other places for ninject interface/implementation bindings, i dont know..)
|
|
|
|
|
I think the parameter "connectionString" of WithConstructorArgument must be the same with Constructor Argument of the class SqlProductRepository.
|
|
|
|
|
Hi guys,
I want to display date and time if I update my website in server(if i insert/update a row in particualar tables) . How to do it in asp.net with sql server database
Ahamed Azeem
software Programmer
|
|
|
|
|
Ahamed Azeem wrote: I want to display date and time if I update my website in server(if i insert/update a row in particualar tables) . How to do it in asp.net with sql server database
better to create a Log table. and display last update from Log Table.
|
|
|
|
|
If you add a "Modifydate" column to your table, then each time you update a row in the table, set the ModifyDate to the CurrentDate-Time. You can then issue a select max(ModifyDate) on that table to display the latest update date on your web page.
|
|
|
|
|
Hi Ahamed Azeem,
Please follow the below db statement.
SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update,*
FROM sys.dm_db_index_usage_stats
WHERE database_id = DB_ID( 'Your DB Name')
AND OBJECT_ID=OBJECT_ID('Your Table Name').
It'll show you last modified DateTime for a particular table in a particular DB. U can remove where condition to view all the records from all the DB tables.
I think u understand it ..
Rajendra Prasad panchati
.Net/Sharepoint Software Engineer.
Hyderabad.
|
|
|
|
|
I m new in Ajax and asp.Net Now i want learn ajax with asp . In My Visual studio 2008 , there is no option is Ajax Wizard . If need any thing install for Ajax , please let me know the URL . And Give simple idea for How can make simple application ...
Thanks...
|
|
|
|
|
Start working with scriptmanager and updatepanel controls for starters. Also try to improve your javascript (as AJAX is really almost nothing more than cool javascript) , and experiment with third party libraries. And actually you may find some articles here on CP[^] about asp.net and AJAX Good luck.
"My personality is not represented by my hometown."
|
|
|
|
|