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..)
michaelschmitt
Posts
-
Ninject and MVC2(Please help) -
web application(rdlc)Hi, you dont have to use subreports. Use a table within your rdlc and link that tables datasource to the datasource containg your working hours. Consider using seperate generic lists as datasources, which you add to your report file one by one. This makes it very easy to choose the correct datasource within your rdlc elements.
-
summary classes for gridviewThe academic way would certainly be to bind a collection of objects which only contain the absolute necessary properties. (Keep the view as stupid as possible) This way, the view cannot mess with data he is not ment to have.. But to be honest, if i dont have huge business entities - maybe even with some crucial methods inside (uh uh), i use them directly within the view. It always depends on the situation i guess. But thats just my opinion.
-
How to fix datareader problem?To be honest, it is not easy to read your code. Could you clean that up a little? While cmd is the created command, cmd1 and cmd2 are executed. It's weird and does not invite someone to look into it in detail. Also, could you describe the problem and maybe some details of the goal you're trying to archive?
-
Enable button and change label's text clientsideOnly if he includes the "return.." part in the OnClientClick also. Like:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test</title><script type="text/javascript"> function Hello() { document.getElementById('Button2').disabled = false; document.getElementById('Label1').innerText = "bye"; return false; } </script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return Hello()" />
<br />
<asp:Button ID="Button2" runat="server" Enabled="False" Text="Button" />
<br />
<asp:Label runat="server" ID="Label1" Text="hello"></asp:Label>
</div>
</form>
</body>
</html> -
Unable to debugI'm guessing there was another reason than stupid microsoft, but i'm glad you solved it=)
-
Give me simple example for API calls in asp.netIf you mean accessing windows dlls / win32 api or something, please search for "p/invoke .net api" in google or have a look here
-
Unable to debugHi there, i could imagine two possible reasons: - You have set debug=false in your web.config and ignore the warning-message on hitting the "playbutton" Example:
<system.web> <compilation debug="false"> ... </compilation>
...
Solution: set debug to true. - Second reason: you have AutoEventWireup in your .aspx markup set to false - and therefore, your page load is not wired anywhere. either set AutoEventWireup to "true" or wire the event up yourself. Thats all i could imagine right now. Good luck
-
problem in displaying money in grid view.Hi, then here is an example on how to do it. Just replace the "((double)0.123)" by your variable and modify the rest according to your needs:
<ItemTemplate>
<asp:Label runat="server" Text='<%# ((double)0.123).ToString("N") %>'></asp:Label>
</ItemTemplate> -
Dropdownlist not displaying selectedItem in GridViewoh dear god, now THAT is simpler=). Thanks
-
Dropdownlist not displaying selectedItem in GridViewHi, you have to set the SelectedIndex of your DropDownList in this event (according to the value of your DataItem) Try something like this:
protected void grdTCCRics_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if ((e.Row.RowState & DataControlRowState.Edit) > 0)
{
DropDownList ddlRegion = (DropDownList)e.Row.FindControl("RegionCodeList");
if (ddlRegion != null)
{
// You have to replace VALUEFROMDATAITEM by the current region
// value of your DataItem (look in e.Row.DataItem, i dont know it)
ListItem item = ddlRegion.Items.FindByValue("VALUEFROMDATAITEM");
ddlRegion.SelectedIndex = ddlRegion.Items.IndexOf(item);//string strregion = ddlRegion.SelectedItem.Text; // You dont retrieve the value of the dropdown here, you set it } } } }
I hope this helps
-
Dropdownlist not displaying selectedItem in GridViewI guess in your markup, you have an edititemtemplate and an itemtemplate, is that right? In your rowdatabound event, it depends on the current rowstate, which controls exist and which not. For example, if you have a label in your itemtemplate and a dropdown in your edititemtemplate, then the label will be null if rowstate == edit and the other way around. So first check if RowState == Edit and then find your dropdown. you will not find the controls shown during "view" rowstate (dont read viewstate:P). GL
-
problem in displaying money in grid view.Hi there, is it a bound field? Then you could use the DataFormatString property. In a custom/template field, you could output your value as string and use string.Format with a fitting format string (like here).
-
Dropdownlist not displaying selectedItem in GridViewHi, maybe there is a simpler solution, but you could use the rowdatabound event of your gridview and set the index of the dropdown there appropriatly (if in edit mode). Here is an example (which is using c1gridview, just replace it by the microsoft one and check the if conditions, they may be slightly different)
protected void grdRoomTypes\_RowDataBound(object sender, C1.Web.UI.Controls.C1GridView.C1GridViewRowEventArgs e) { if (e.Row.RowType == C1.Web.UI.Controls.C1GridView.C1GridViewRowType.DataRow) { if ((e.Row.RowState & C1.Web.UI.Controls.C1GridView.C1GridViewRowState.Edit) > 0) { // here find your dropdownlist by id and set the index TimeSchemeEditor editor = (TimeSchemeEditor)e.Row.FindControl("timeSchemeEditor"); editor.TimeScheme = (ServiceDirectoryRoomTypeItem)e.Row.DataItem; } else { // Do nothing here maybe TimeSchemeViewer viewer = (TimeSchemeViewer)e.Row.FindControl("timeSchemeViewer"); viewer.TimeScheme = (ServiceDirectoryRoomTypeItem)e.Row.DataItem; } } }
-
Avoiding Button Double Click - AJAXNice ideas in this thread. I like.
-
Return List<> on button click of user control.If it is just about the collection you want to expose now, you can either do this:
public ftExclusions GetSelectedExclusions()
{
ftExclusionsList myFTExclusionList = new ftExclusionsList();foreach (ListItem li in cblExclusions.Items)
{
if (li.Selected == true)
{
ftExclusions myftExclusion = new ftExclusions();
myftExclusion.excluId = Convert.ToInt32(li.Value);
myftExclusion.excludesc = li.Text.ToString();
myFTExclusionList.Add(myftExclusion);
}
}
return myFTExclusionList;
}or this (property):
public ftExclusionsList SelectedExclusions
{
get { return GetSelectedExclusions(); }
}private ftExclusions GetSelectedExclusions()
{
ftExclusionsList myFTExclusionList = new ftExclusionsList();foreach (ListItem li in cblExclusions.Items)
{
if (li.Selected == true)
{
ftExclusions myftExclusion = new ftExclusions();
myftExclusion.excluId = Convert.ToInt32(li.Value);
myftExclusion.excludesc = li.Text.ToString();
myFTExclusionList.Add(myftExclusion);
}
}
return myFTExclusionList;
}Then use the property OR method in the desired event of your page. This is all assuming that the rest of the code works. A hint: Check for null before checking the count of a collection. Otherwise, you could get an exception. It is also usefull to check like
if (null==something)
// instead of
if (something == null)This way, you can prevent typing mistakes like If (something = null)... GL GL
-
Return List<> on button click of user control.Hi, i was talking about the button click event in your usercontrol. You have to somehow let the page know that the user clicked the button within your usercontrol. You could do this by using a delegate similar to this. I made a comment there with an example. You have to replace the text-parameter by your custom item collection. This would work. (Or you just notify the page and the page accesses the items though a public property of your control). Does this help or am i confusing?
-
Return List<> on button click of user control.Hi, if i were you, i would not start passing controls from one page or usercontrol to another. The method explained in the above post is the way to go. Always keep in mind that your controls/classes should have a (clean seperated) job. Maybe you wanna reuse this control somewhere else where the calling page doesnt have/need a gridview? keep your "interfaces" as simple as possible. So, in your UserControls' Button click event, raise an event or something, which is subscribed in Page load of your Page class. This ways, your page can access the mentioned public property of your usercontrol once the event occurs. Or you could even pass your "result" though this event/delegate and access it without the necessity of a public/internal property.
-
Convert String to Int"Was" not working or "is" not working? The above mentioned solution (int64 + parse) works fine. Tested:
string test = "10000000000";
System.Int64 int64 = Int64.Parse(test);
and it is totally ok.
-
Model PopUp ProblemYou're using the ModalPopupExtender from the AjaxToolKit, right? If so, the problem is the occurring postback while paging. Although i remember that there was a better solution than mine, i unfortunately dont remember the solution itself..So heres mine: Either put the content of your popup in a seperate updatePanel (if that works for you), or call the Show method of your popupextender again in the paging event. This way it should stay open (at least i'm doing this somewhere in a click-event of a button and this way it stays open). Hope this helps somehow.