Welcome Guest Search | Active Topics | Sign In | Register

Multiple TextBoxColumn in a grid displaying dynamically Options
SP
Posted: Thursday, May 26, 2011 1:10:31 PM
Rank: Newbie
Groups: Member

Joined: 5/26/2011
Posts: 3
Hi - we have a grid that has various columns. One of it is a textboxcolumn where we need to validate and restrict the textboxcolumn for say 100 characters to be entered. However, the validation does not work and the textbox column allows more than 100 characters even though the maxlength property is specified.

Also, the grid rows are dynamically generated based on the number of rows returned from the dataset. There is no id associated to the textboxcolumn. How can we workaround this issue

Thanks,
SP.
eo_support
Posted: Thursday, May 26, 2011 1:18:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

If you use single line text box, then you can set maxLength.

There is no built-in max length mechanism for multi-line textbox, so you must write JavaScript code to do that. If you search online you should be able to find plenty of information on this topic.

Your JavaScript code will need the ID of the textbox. The ID of the textbox used by the Grid is "GridID_cxx_edit_tb", where "GridID" is the client side ID of your grid control and "xx" is the zero based column index. Each column only uses a single textbox. So number of rows does not matter.

Thanks!
SP
Posted: Thursday, May 26, 2011 1:32:57 PM
Rank: Newbie
Groups: Member

Joined: 5/26/2011
Posts: 3
Say if my textboxcolumn was in the 12 position, it would be mygridname_c12_edit_tb? Also, how do I get the values of the textboxcolumn and check for the length. I tried var textb = document.getElementById("gvlog_c12_edit_tb");
and the textb returns null although I entered some value in the textboxcolumn
eo_support
Posted: Thursday, May 26, 2011 1:41:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The index is zero based. So it will be "c11" instead of "c12". You can also find out the exact ID by viewing the rendered HTML code.

As to how to get the value of the textbox and check for the length is something you want to search online about. That part has nothing to do with us. We only tell you the ID of the textbox and the rest are just standard DHTML and JavaScript.

Thanks
SP
Posted: Friday, May 27, 2011 12:08:02 PM
Rank: Newbie
Groups: Member

Joined: 5/26/2011
Posts: 3
Well , I tried to get the value and somehow javascript doesnt seem to work. The value in that textboxcolumn shows as null. I have pasted the grid and the textboxcolumn with the properties we have set. Is there anything that would seem to cause the issue.

<eo:Grid runat="server" ID="gvLog" AllowColumnReorder="false" AllowNewItem="false"
EnableKeyboardNavigation="true" GridLines="Both" GoToBoxVisible="True" ScrollBars="Vertical"
Width="600px" Height="400px" FixedColumnCount="1" ColumnHeaderDescImage="00050205" ColumnHeaderDividerImage="../images/eoheader_divider.gif"
GridLineColor="220, 220, 220" IsCallbackByMe="False" ItemHeight="19" ColumnHeaderAscImage="00050204"
ColumnHeaderHeight="35" Font-Size="8.75pt" Font-Names="Tahoma"
FullRowMode="False" ClientSideOnItemCommand="OnItemDelete" ClientSideOnCellSelected="cell_selected">

<eo:textboxcolumn DataField="Notes" HeaderText="Notes1" TextBoxMode="MultiLine" TextBoxRows="5" AllowResize="true" TextBoxWidth="200" MaxWidth="550" ClientSideEndEdit="on_end_edit_notes">
<CellStyle CssClass="editableNotesCell" />
<eo:textboxcolumn>
This is the javascript I am using
function on_end_edit_notes(cell) {
var grid = eo_GetObject("gvLog");
var cell = grid.getSelectedCell();
if (cell.getColIndex() == "12")
var textb = document.getElementById("gvlog_c12_edit_tb");
if (textb == null)
textb = document.getElementById("gvlog_c12_edit_tb").value;
alert(textb);
return false;
}

Please let us know.

Thanks,
SP.
eo_support
Posted: Friday, May 27, 2011 12:21:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You really must troubleshoot such problems yourself. You are basically asking why you can not get the value of a textbox in your page with Javascript. This is a generic Web programming question that does not have anything to do with our product.

Even though we understand that the question arises while you are using our product, what you are trying to use is not part of the Grid. It’s not a feature of the Grid. You wanted to do something beyond what’s already provided by the product. In such case usually we don’t mind to point you to the right direction but we will not troubleshoot your code for you. From the Grid's point of view, we give you the ID of the textbox and that's where it ends on our part.

If you believe there is anything on the Grid that is not functioning correctly and is causing the problem for you, please try to create a test page that demonstrates the problem. We will be happy to take a look as soon as we have that. Otherwise we consider this a generic Web programming question and beyond the scope of our support.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.