how to stop the variation of devexpress textbox's width - devexpress

i have web form running in asp.net & c#.net,
The form has a devexpress aspxtextbox and the another ordinary textbox with a button.
The scenario is enter a text longer than the width of the text box in the ordinary text box.
on clicking the button it enters the text in to devexpress aspxtextbox ,increasing the width of the devexpress aspx text box inspite of width given as 50 px.
how to maintain the fixed width for devexpress aspx text box

e adding the property native ="true" solved out the issue.

Unfortunately, Dev Express has this problem in IE7 Document Standards Mode, and usually the reply you'll get from them is something like "The control is designed this way." This doesn't help us in IE7. The problem isn't only with ASPxTextBox, but also happens with others, such as ASPxComboBox.
While making the control native will work, you lose various styling, etc.
Here is another way that keeps the control non-native:
javascript:
function SetInnerWidth(s, e) {
s.widthCorrectionRequired = true;
s.AdjustControl();
}
devex control:
<dx:ASPxTextBox …… >
.
.
<ClientSideEvents Init="SetInnerWidth” />
.
.
</dx:ASPxTextBox>

Related

Hide/ show 'Add new record' in telerik:RadGrid

So i have page contain telerik:RadGrid on top of the grid there Add new button i want when the user not allow to add new record to put visible =false
else visible =true i want to do it in code behind
All I can find on net is how to disable the button, and this not what I want I want - to hide/show it depend on user
I am assuming your grid's name as gridExample. gridExample.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false will help you in hiding or showing based on the user.
I've had this problem before too. I never found a RadGrid property where you can make the Add new record button invisible. The way I solved it was a little hackish. You can do this with CSS, or JQuery.
The name of the button is usually something like ctl00$ContentPlaceholder1$RadGrid1$ctl00$ctl02$ctl00$AddNewRecordButton. So I've used javascript/JQuery to hide it. The javascript would look like:
$('#ctl00$ContentPlaceholder1$RadGrid1$ctl00$ctl02$ctl00$AddNewRecordButton').hide();
You would need server-side (ASP) logic to put this code in your (client-side) JQuery page startup code.
For your page, you might need to change the name (above), if your grid is not named RadGrid1. To find the name of your control, you can view source, or use the DOM debugger (F12 in InternetExplorer) and find the text "Add new record".
You use call ShowAddNewRecordButton. Please ensure you call MasterTableView.Rebind depending on your logic.
RadGrid1.MasterTableView.CommandItemSettings
.ShowAddNewRecordButton = true;
RadGrid1.MasterTableView.Rebind();
Add <CommandItemSettings ShowAddNewRecordButton="false" /> inside the MasterTableView like below
<MasterTableView>
<CommandItemSettings ShowAddNewRecordButton="false" />
<Columns>
</Columns>
</MasterTableView>

asp.net website button

I need some help for my website.
I have three buttons, I need some help to link them to a content area that I have on the site.
When I press button one the content will change like <h1>Button one<h1> and the the rest of the code will follow . I have already the content setup so only I need is a example for the button code. The rest of the website will be the same.I am using asp.net c# 4.0
I am assuming you want to change the content of Content Area on click of button. For that you need to handle the click event of button and change the content on click function. Read here http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.click.aspx
To make h1 accessible from code-behind:
<h1 runat="server" id="H1Control">Button one<h1>
Then on YourBtn_Click() method assign new value this way:
H1Control.InnerHtml = "New text";
As your suggests,I think u want to change the content within <h1></h1>.Here is the code to do that.
<h1 runat="server" id="something">Button 1</h1>
In code behind inside button click event do this..
something.InnerHTML="new text"

weird Ajax ComboBox drop down list

I've got combobox inside some panel :
<ajaxToolkit:ComboBox
ID="YearList"
runat="server"
OnInit="YearList_Init1"
EnableTheming="false"
Width="45px"
ViewStateMode="Disabled" />
and it was OK before I updated project to .NET 4 , after updating project (And AJAX) to .net4 it's looking like really strange ... I can't explain it proper , I will show :
how can I fix it ? :) Full CSS / ASPX page here -> https://github.com/nCdy/Issues/tree/master/Ajax%20ComboBox (string # 287)
I had a similar issue and could resolve mine by removing the extender that I had added to the Panel containing the combobox. I had used a DropShadowExtender for the Panel, removing it caused the combobox to be displayed perfectly. Perhaps you can try that as well.
i am seeing a lot of texts like
Контрактный час
:
, every where in your form. So i need to know, are you using some sort of encoding , that is, is this placed by you or came unexpectedly. If you havent placed it, remove all unneccessary such lines and use plain text instead (if required). Then check the layout.
Also in your image, i can see , ur language is russian(if i am right :)). So try using your localized font that is direcly supported by aspx as we use english or better use resource file instead of the hardcoded text on the page. As per my view the language conversion is creating such issue.

What is the easiest way to disable a form but keep it readable?

I have my form fields in a Panel which, if a read-only version is required, I set Enabled = False on the Panel. This was quick and dirty and the results are mostly dirty, mostly in IE. Can't scroll through large ListBoxes. Multi-line TextBoxes only show the first few lines. There's some funky styling to disabled Labels.
Do you have any ideas as to how to disable an entire form, letting the user read the data, visually indicating that it is disabled (gray input or text in place of input), but to the server keep the control disabled so it's not loading any data that could be manipulated by enabling fields by nefarious means.
(Also, I'm hoping I don't have to add a label corresponding to each data field.)
You could remove all the buttons and use jQuery to change the background color on all inputs. This would be a quick and easy solution.
$(':input').addClass('disabled');
You can have your fields assigned the readonly attribute, ie:
<input type="text" name=myText value="Enter Your Name" readonly>
This can easily be done with js but is more robust if done right in html.
You could also disable or even remove the submit button.
I would use the ASP web controls. The TextBox for the input type="text".
All web controls have the enabled property
<asp:TextBox id="txtSomething" runat="server" />
You can now enable/disable all controls from code like you do today (for the panel). But you have to do it for every one (I don´t know how many you have).
txtSomething.Enabled = False
You can also do this with JavaScript.
Loop all elements in the form, and disable/enable them.
function DisableEnableForm(myForm,setDisable){
elems = myForm.elements;
for(i=0;i<elems.length;i++){
elems[i].disabled = setDisable;
}
}
You can trigger this JavaScript function from ASP like this:
Button1.Attributes.Add("onclick", "javascript:DisableEnableForm(´form1´,true)");

Resize textbox everytime to fit the text length

In my ASP.NET page I have a text box which shows data which is bind to an (JavaScript) object variable.
I want that textbox to resize everytime, the JavaScript object, e.g. result.title will change everytime.
Important:
I want to fit the textbox exactly to the text length inside.
Here is a great tutorial that teaches you how to make a jQuery plugin to do exactly what your talking about.
You could use onChange:
<textarea onChange="resize(this)"></textarea>
<script>
function resize(el) {
el.cols = el.value.length;
}
</scrip>
Btw are you using Ajax?
Here's a jQuery plug-in: http://www.unwrongest.com/projects/elastic/

Resources