.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Specify width on EditorFor input field

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
I happily use the new variant of TextAreaFor that allows me to specify the width for the field. TextAreaFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, Int32, Int32, Object) Is there any way I can set the width when using an EditorFor or TextBoxFor method? 

View Complete Post

More Related Resource Links

Enter input field don't fire in firefox


Known problems but I couldn't solve it yet.

I have one asp:TextBox and input filed with type="button". I want to fire js function when hit Enter when I am in TextBox.

I have js function-DoEnterSearch that doesn't fire in Firefox.

So, I have in CodeBehind:

        searchPage = "~/productsearch.aspx";

        //Create link and add parameter to btn
        searchPage = this.Utilities.UrlHelper.HandleRootOperator(searchPage);
        // Button Click
        btnSearch.Attributes.Add("OnClick", "DoSearch('" + searchPage + "','" + tbSearch.ClientID + "')");
        // Enter click
        tbSearch.Attributes.Add("OnKeydown", "DoEnterSearch('" + btnSearch.ClientID + "')");

In ascx:

            <asp:TextBox ID="tbSearch" runat="server" ToolTip="Name" class="tbSearch input_text text_darkgrey" value="Trazi"></asp:TextBox> 
            <input type="button" id="btnSearch" runat="server" value="Search name="Search" class="button1"/>

And js function:

I am updating a currency field of an access table through detailsview, cannot input decimals.


I changed a text field to a template field assigning the selected text and the selected value is being assigned to another currency field also templated. I get aa error

[FormatException: Input string was not in a correct format.]

Could you please give me a few tips on this one. Thanks

how to capture text from text field and pass to input parameter of dataconnection added as rules in


Hi All,

I have a small application on infopath form published to Sharepoint form library.

I have a text field where i enter serial number to search.

And on rules of search button i added rule where i pass input text to input parameter of dataconnection.

This dataconnection is actually a web service which get details of serial number from SQL database

and then on another button "remove record" rule added where if data is there..which result from first button then delete record from form library and database and enter log details to SQL table ..these all steps writtern in try catch of a webservice.

My problem is:

1. when i enter text to search i need to click twice on search button to get data from SQL ..or i have to click on outside of text field (anywhere in form) to get the event changed and then to click to button to search.

2. when i click on "remove record" button i get error message as error in accessing datasource..

but when i check in preview its working fine


pls advise


-- Regards Sandeep

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

calculation, field and map traverse adjustment, and coordinate transformation

Free Pocket PC land surveying software -- COGO calculation, field and map traverse adjustment, and coordinate transformation -- for students and professionals.

Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

I need help about nvarchar field



how can specified nvarchar data type without N''?

adding XML 'records' with a key field


I have a vb.net Sub that is successfully adding 'records' to my XML file:

Private Sub btnSubmit_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.Click             'for adding an XML 'record'
        Using ds As New DataSet()
            Dim dr As DataRow = ds.Tables(0).NewRow()
            dr("subject") = txtNewEvent.Text
            dr("year") = DateTime.Now.ToString("MM/dd/yy")
            txtNewEvent.Text = ""

Unable to get all the values from a field


Am reading an XML from web service and storing in  a dataset. 
then in write to a DataTable as follows

 DataTable dtResult1 = dsSearch.Tables["RESULTSET"];    
 DataTable dtHIT = dsSearch.Tables["HIT"];     
 DataTable dtField = dsSearch.Tables["FIELD"]; 

The issue  is  in the DataTable dtField i can only see 3 columns FieldID,Name,HIT_ID

The corresponding values in the dataTable looks like this for the corresponding fileds


I am unable to get the Field Name values 1,8799f4646b6ed9acde142581a84f75a6 ,234B5F5F-F247-4EB6-9E39-A7B64C7FE1BD,Yes...etc

What would be the cause for this...Any Help

Below is the structure of the XML-

- <HIT NO="1" RANK="2955" SITEID="0" MOREHITS="0" FCOCOUNT="0"> 
<FIELD NAME="rank">1</FIELD> 
<FIELD NAME="internalid">8799f4646b6ed9acde142581a84f75a6 </FIELD> 
<FIELD NAME="contentid">234B5F5F-F247-4EB6-9E39-A7B64C7FE1BD</FIELD> 
<FIELD NAME="contentids" /> 
<FIELD NAME="collection&

Individual field - MySQL



I was wondering how to recieve an individual field from my MySQL database.

I have been able to get a row, but what I am trying to do is get a name from my database and set it into the HeaderText in my DataGrid.

The way I am trying to do it at the moment is

using (OdbcCommand cmd = new OdbcCommand(formQuery, con))
                formDataGrid.Columns[0].HeaderText = cmd.ExecuteReader(
                    CommandBehavior.CloseConnection |

This doesn't seem to get a value from the GetValue, but if use

using (OdbcCommand cmd = new OdbcCommand(formQuery, con))
                formDataGrid.DataSource = cmd.ExecuteReader(
                    CommandBehavior.CloseConnection |

it will bind my data into the grid.

I just want to be able to change the HeaderText in the first coulmn of the DataGrid from one table and have the DataGrid be filled from another table.

I can fill the DataGrid its just changing the HeaderText that I am having trouble with.

Any help?

Validate form input - Japanese


 I've searched for several hours and haven't come up with a reference - or even many discussions - of how to go about validating Japanese names, addresses, etc. When I lived in Japan websites, atm's etc. required such info to be entered with the roman alphabet but I've seen some websites that are allowing Kanji/Hiragana/Katakana. I haven't tested many of them for validation but one that I did test (after looking at the page source and discovering no client-side validation) allowed me to put this in the name field: J*=123*go^ Neat!

Any pointers/references? Thanks

Input Validation: Enforcing Complex Business Data Rules with WPF


Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.

Brian Noyes

MSDN Magazine June 2010

Office Space: Custom Field Types for SharePoint 2007


Custom field types provide a powerful way to define a reusable SharePoint column definitions.

Ted Pattison

MSDN Magazine May 2009

Secure By Design: Your Field Guide To Designing Security Into Networking Protocols


If you were to build a new communications protocol from scratch, how would you address security? Here the authors take a look at that question and generate some valuable insights into secure protocols.

Mark Novak and Andrew Roths

MSDN Magazine September 2006

InfoPath: Turn User Input into XML with Custom Forms Using Office InfoPath 2003


Office InfoPath 2003 is a new Microsoft Office product that lets you design your own data collection forms that, when submitted, turn the user-entered data into XML for any XML-supporting process to use. With an InfoPath solution in place, you can convert all those commonly used paper forms into Microsoft Office-based forms and end the cycle of handwriting and reentering data into your systems. Today organizations are beginning to realize the value of the mountains of data they collect every day, how hard it is to access it, and are striving to mine it effectively. InfoPath will aid in the design of effective data collection systems. Here the author shows you how to get started.

Aaron Skonnard

MSDN Magazine September 2003

Help with form input and post


I'm trying to teach myself MVC and have been having a few problems trying to handle a form input and post scenario. I am trying to have a section at the top for searching that appears on every page (like there is on sites like amazon).

I've read websites such as: http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx and tried to follow their example form post code in my Site.master file. 

The problem I'm having is that it always calls the default controller action, regardless of what I put as the url in the form action (in fact, I can even remove the form tags altogether and it doesn't seem to make a difference -the text box will still call the default controller when I press enter).

In my site master file, I have tried the using the following html markup:

<form action="Home/SearchResults" method="post">
                    <input id="Search" type="text" name="searchText" />
                    <input type="submit" value="Search" />


which is the for

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend