Consider the feature in Visual Studio 2010 for snippets in the HTML Source view of a web page.
type a control name in plaintext with no markup or brackets!
... e.g. hyperlink.
Then hit Tab
Your web control has been auto-completed for you. It's up to you to fill in the other details that you need.
This works for form as well:
<form action="default.aspx" method="post">
</form>
This looks like a real time saver. This is supported in WebForms and ASP.NET MVC projects.
What other snippets are available in Visual Studio 2010 in the Source view of a page?
Hi,
I have an address control which display the contact info of the person.
so it displays something like
1234, street
City, CA 12345
Now i want to give user flexibility to create format out of it.
For ex someone might want to display address as,
street, City, Country
OR
Just display their emails:
[email protected][email protected]
Any good ideas on how to it or similar examples?
thanks
I have a form with a panel docked in it. I then dynamically create 15 panels (named: panel_n) and 15 pictureboxes (named: picturebox_n) on the primary panel (named ContainerPanel).
When dragging the any picturebox over a panel (panel_n) created using the relevant mouse events. I would like to get the panel's name that the picture box was dragged over. The mouse cursor seems to be captured.
I have tried creating a IMessageFilter interface, but there are still no events that trigger when dragging one of the pictureboxes over any one of the panels.
The ClientRectangle.IntersectsWith function also does not work as the co-ords are always 0,0.
All I need is the panel name where the picturebox was dragged over (preferably on the mouseup event)
How can i solve the following (simplified) problem?
M-V-VM context. I want to show text at the UI.
In case the user has the rights to change the text, i want to use a textbox to manipulate the text.
In case the user has no rights, i want to use a label to only show the text.
My main problem: how to exchange textbox and label and bind Text resp. Content to the same property in viewmodel.
Thanks for your answers
Toni
I have 2 input textboxes that take a host or IP. When the user leaves an input box an event is fired that checks the input to see if it is actually a live computer. The results are then put into the appropriate label.
My question is, should I be using separate events for each input box, since they update different labels? Or, can I use 1 event and check who the caller was, then update the appropriate label?
Hi guys,
I have a View with a Master Page. The user control makes use of a Model:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BudgieMoneySite.Models.SiteUserLoginModel>" %>
This user control is shown on all screens (Part of the Master Page). If the user is logged in, it shows a certain text, and if the user isn't logged in, it offers a login box.
That is working OK.
Now, I am adding my first functional screen. So I created a new view... and, well, i generated the basic view code for me when I selected the controller method, and said 'Create View'.
My Controller has this code:
public ActionResult Transactions()
{
List<AccountTransactionDetails> trans = GetTransactions();
return View(trans);
}
private List<AccountTransactionDetails> GetTransactions()
{
List<AccountTransactionDto> trans = Services.TransactionServices.GetTransactions();
List<AccountTransactionDetails> reply = new List<AccountTransactionDetails>();
foreach(var t in trans)
{
AccountTransactionDetails a = new AccountTransactionDetails();
foreach (var line in a.Transactions)
{
AccountTransactionLine l = new AccountTransactionLine();
l.Amount = line.Amount;
l.SubCategory = line.SubCategory;
l.SubCategoryId = line.SubCategoryId;
a.Transactions.Add(l);
}
reply.Add(a);
}
return reply;
}
So, my view was generated with this:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Collections.Generic.List<BudgieMoneySite.Models.AccountTransactionDetails>>" %>
Found <%=Model.Count() % Transactions.
All I want to show for now is the number of records I will be displaying.
When I run it, I get an error:
"The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[BudgieMoneySite.Models.AccountTransactionDetails]', but this dictionary requires a model item of type 'BudgieMoneySite.Models.SiteUserLoginModel'."
It looks like the user control is being rendered first, and as the Model from the controller is my List<, it's breaking!
What am I doing wrong?
Hi,
In designing an XForm interface to an XML database (using eXist and XSLTForms), I'd like to include an input control for an optional element. The XML data records already exist and while some contain the optional element, others don't. To update a record, I'm using the existing XML record as the model instance. The problem is that the form control is not displayed when the optional element is not present, which is logical, but presents a problem when a user wants to add data to the optional element.
To be more explicit, here's an example data record, data.xml:
<a>
<b>content</b>
</a>
with RNC schema:
start =
element a {
element b { text },
element notes { text }?
}
XForms model:
<xf:model>
<xf:instance xmlns="" src="data.xml"/>
<xf:submission id="save" method="post" action="update.xq" />
</xf:model>
And control:
<xf:input ref="/a/notes">
<xf:label>Notes (optional): </xf:label>
</xf:input>
The problem is that the 'Notes' input control is simply not displayed.
An obvious solution is to add a trigger button to allow the user to insert the element if needed, but it is preferable to just have the input control appear, and be empty.
My question is: is there some subtle combination of lesser-know attributes/binds/multiple instances/xpath expressions that will cause the control to always be displayed?
Thanks
I am stuck on how to pass data from one control to another. If I have a listbox control and the Contol Item contains a datatemplate which renders out 5 fields ( first name, last name, email, phone and DOB) all of which come from an observable collection. How can I allow the user to select a listbox item and have the valuesbe stored within a new listbox control?
Is this done through the creation of a new collection or is there a more simple way to bind these values to a new control?
thank you,
What's the easiest way to set the font sizes for ALL telerik control to a single value? I believe you can control fonts by modifying the CC of a specific control, but that's a pain because I am using many different control types...
I add GroupBoxes to an ItemsControl dynamically using:
string name_ = "TestName", header_ = "TestHeader"
GroupBox MyGroupBox = new GroupBox { Name = name_, Header= header_, Width = 240, Height = 150, Foreground=new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)) };
MyItemsControl.Items.Add(MyGroupBox);
Now I need to add content to this GroupBox, like a few TextBlocks created like:
TextBlock MyTextBlock = new TextBlock {Text = "test"};
But I can't figure out how to do that. Normally to a Grid or something like that I would just use .Children.Add(MyTextBlock), but that doesn't work here.
Also I have to be able to remove specific Items from the ItemsControl again (best would be by the name of the Item, name_ in this example).
Hello.
I have a TileList which represents some remote data. I also have a form which allows me to change the data. And the data may be changed by someone else too.
What is the best way to maintain data in the list in an up-to-date state? The simplest option I see is the following:
Select an item in the list
Edit it in the form
Save it. The form submits the data to the server
When the server reports success the list re-fetches it's data
The very bad thing about this workflow is that the list loses selection (a tree would also loose the nodes' expanded/collapsed state). I would really love to find out another option which would enable the list to maintain it's selection state. Any guesses on how it may be done?
This is a very strange problem and i really dont have a clue whats causing it.
What is supposed to happen is that a call to the BLL then DAL returns some data via a linq SPROC call. The retunred IMultipleResults object is processed and all results stored in a hashtable.
The hashtable is stored in session and then the UI layer uses these results to dynamically generate some gridviews.
Easy you would think.
But if i run the code i dont get any gridviews. If i take out the call to the BLL and DAL the gridviews appear but with nothing in them?
Why is it the page renders correctly when i take out the call to get the data?
Thanks.
I need to be able to add items to a listbox inside of a thread. Code is below.
1. ref class Work
2. {
3. public:
4. static void RecieveThread()
5. {
6. while (true)
7. {
8. ZeroMemory(cID, 64);
9. ZeroMemory(message, 256);
10. if(recv(sConnect, message, 256, NULL) != SOCKET_ERROR && recv(sConnect, cID, 64, NULL) != SOCKET_ERROR)
11. {
12. ID = atoi(cID);
13. String^ meep = gcnew String(message);
14. lbxMessages->Items->Add(meep);
15. check = 1;
16. }
17. }
18. }
19. };
I get the error Error: a nonstatic member reference must be relative to a specific object on line 14. Is there any way to get it to let me do that? Because if I try to use String^ meep; outside of that Thread it doesn't contain anything. It works PERFECT when I use it within the thread but not outside of it. I need to be able to add that message to the listbox. If anyone can help I would appreciate it.
I develop a game that has a big number of buttons (25).
I want to know if i can access them without initiating them in interface (.h) in my implementation class.
Is there a way of changing/adding to the windows Open/Save common dialog to add extra functionality?
At work we have an area on a server with hundreds of 'jobfolders'- just ordinary windows folders created/managed automatically by the database application to house information about a job (emails/scanned faxes/Word docs/Spreadsheets/Photos etc) The folders are named by the job Number.
I would like to expand the standard open/save dialog with a combobox which searches for jobfolders based on tags from the database, so that whatever my users are doing they can easily find their way to the correct jobfolder to find/save their work
Connecting to the database and providing the functionality to search is no problem, but is there a way to add a combobox control (ideally with a keypress/keydown event) to the dialog?
Or Create my own dialog and have it called/used in place of the standard one? i.e. from ANY app my dialog would be called allowing easy access to the jobfolders. If they are in outlook they can find a jobfolder quickly, if there are using Notepad they can still find the folder easily.
This would mean a new unified way of finding jobfolders from any app.
Ideally someone would know a way using VB/VB.net/C# but I'm guessing, if its possible, its probably going to be C++.
I have put several buttons and panels in my update panel. I also have a script manager on that page. now when I click on any of the buttons then the functionality is working fine but problem is that the complete page gets reloaded witha a flick, instead of updating the update panel only.
I have set the "children as trigger" property of update panel "true".
please help.
I'm adding some textboxes to a form dynamically at runtime. Everything works fine i.e. the textboxes are aligned, anchored and automatically resizes until the form is maximized. On maximizing the form, the textboxes are added to the same location while the form was not maximized. This causes a misalignment of the textboxes.
How can I ensure that all the textboxes are at the same location and of the same size both while the windowstate is normal as well as maximized?
EDIT:
Btw I'm using C#
EDIT:
Would a flowlayoutpanel be useful here?
Recently, I had a user control I was developing throw an exception. I know what caused the exception, but this issue got me thinking. If I have a user control throw an exception for whatever reason and I wish to replace that usercontrol with something else (e.g. an error saying, "Sorry, this part of the page broke.") and perhaps log the error, what would be a good way to do it that could be done independently of what the user control is or does (i.e. I'm not saying what the user control does/is, because I want an answer where that is irrelevant).
Code sample:
<asp:TableRow VerticalAlign="Top" HorizontalAlign="Left">
<asp:TableCell>
<UR:MyUserControl ID="MyUserControl3" runat="server" FormatString="<%$ AppSettings:RVUC %>"
ConnectionString="<%$ ConnectionStrings:WPDBC %>" Title="CO" />
</asp:TableCell>
<asp:TableCell>
<UR:MyUserControl ID="MyUserControl4" runat="server" FormatString="<%$ AppSettings:RVUA %>"
ConnectionString="<%$ ConnectionStrings:WPDBA %>" Title="IEAO" />
</asp:TableCell>
</asp:TableRow>
I have a web part which uses validation on a textbox field to prevent submission of an empty field. When clicking on Check In to Share Draft or Publish, this validation is done, and since I am not actually trying to submit the form, but rather check it in, I'd rather this didn't happen.
How can I achieve this?
See also: Sharepoint web part form validation blocks updating web part settings - this has the validation code, and how I solved the problem of the EditorPart setting off the validation.
<div runat="server" enableviewstate="false">
<div runat="server" enableviewstate="false"></div>
</div>
What happends if I won't set the enableviewstate property for the second div. Is it inherited from it's parent or not ?
If I have a user control which has server control label, the label is not initialized if the user control is inherited by another user control. When does the label get initialized? In the case of when its host user control is used as a base user control.
i have about 50 labels that are each just barely big enough to fit the letter x in them. the labels are on a report. i need to align all the labels very precisely.
is there an easier way to do this than trusting my eyes?