i am having a FORMTEMPLATE inside which i have taken some text boxes which are bound to data corresponding to their colums.
Along with these textboxes are, INSERT AND UPDATE buttons.
Now my issue is that when i click on either of the two buttons, i need to perform client side (java script) validations like checking that mandatory fields should not be empty.
My Questions :-
1.) Where to register the client side function call.
For example :- if i have to call abc() then where should i write
BtnUpdate.Attributes.Add("OnClick","abc()")
2.) And secondly how to pass the ID's of the text boxes that i have taken inside the form template since these gets renderedto a different client id's.
Is there some client side method exposed by APi through which i could extract these fields.
I am attaching the code snipet
<
telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" GridLines="None"
PageSize="6" AutoGenerateColumns="False" Skin="Default2006">
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView CommandItemDisplay="Top" ClientDataKeyNames="CURR_SYS_ID" DataKeyNames="CURR_SYS_ID,curr_Appr,curr_mdel" EditMode="PopUp" >
<EditFormSettings>
<PopUpSettings ScrollBars="None" />
</EditFormSettings>
<ExpandCollapseColumn
Resizable="False" Visible="False">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<RowIndicatorColumn
Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<CommandItemTemplate>
<div style="padding:10px 0px;">
<asp:LinkButton runat="server"
ID="lnkEdit" CommandName="EditSelected">
<img style="border:0px;vertical-align:middle;" alt="" src="Images/icon_edit.gif" />
Edit Selected Record
</asp:LinkButton>
<asp:LinkButton runat="server" ID="lnkReject"
Text="Reject" CommandName="Reject">
<img style="border:0px;vertical-align:middle;" alt="" src="Images/icon_delete.gif" />
Reject Selected Record
</asp:LinkButton>
<asp:LinkButton runat="server" ID="LinkApprove" Text="Approve" CommandName="Approve">
<img style="border:0px;vertical-align:middle;" alt="" src="Images/icon_delete.gif" />
Approve Record
</asp:LinkButton>
<asp:LinkButton runat="server" ID="lnkInsert" CssClass="MyImageButton" Text="UpdateEdited" CommandName="InitInsert">
<img style="border:0px;vertical-align:middle;" alt="" src="Images/icon_add.gif" />Insert New Record
</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="DeleteRecord" >
<img style="border:0px;vertical-align:middle;" alt="" src="Images/icon_add.gif" /> Delete this Record
</asp:LinkButton>
</CommandItemTemplate>
<Columns>
<telerik:GridBoundColumn DataField="curr_code" HeaderText="Currency Code" MaxLength="3" UniqueName="Currency Code"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_name" HeaderText="Currency Name" MaxLength="25" UniqueName="Currency Name"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_sign" HeaderText="Currency Sign" MaxLength="5" UniqueName="Currency Sign"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_desc" HeaderText="Currency Description" MaxLength="240" UniqueName="Currency Description"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_decimal" HeaderText="Decimal Spaces" MaxLength="1" UniqueName="Currency Decimal"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Curr_Sys_Id" ForceExtractValue="Always" HeaderText="Currency Sys Id" ReadOnly="True" UniqueName="curr_sys_id" Visible="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_Appr" ForceExtractValue="Always" HeaderText="Approval Flag" MaxLength="2" ReadOnly="True" UniqueName="curr_Appr" Visible="False"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="curr_mdel" ForceExtractValue="Always" HeaderText="Deletion Flag" ReadOnly="True" UniqueName="curr_mdel" Visible="False"></telerik:GridBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<PopUpSettings Width="60%" />
<FormTemplate>
<table id="Table1" class="TableWidth" cellspacing="1" cellpadding="1" width="250" border="0">
<tr>
<td colspan="4" >
</td>
</tr>
<tr class="DataRowColor">
<td> Currency Code </td>
<td><asp:TextBox ID="txtCurrCode" OnBlur="return validateCurrencyCode();" Text='<%# DataBinder.Eval( Container, "DataItem.CURR_CODE") %>' runat="server">
</asp:TextBox></td>
<td>Currency Name </td>
<td>
<asp:TextBox ID="txtCurrName" Text='<%# DataBinder.Eval( Container, "DataItem.CURR_NAME") %>' runat="server">
</asp:TextBox></td>
</tr>
<tr class="DataAlternateRowColor">
<td>Currency Sign</td>
<td>
<asp:TextBox ID="txtCurrSign" OnBlur="return checkMandatory('Currency Sign cannot be blank');" Text='<%# DataBinder.Eval( Container, "DataItem.CURR_SIGN") %>' runat="server">
</asp:TextBox></td>
<td>Currency Description</td>
<td>
<asp:TextBox ID="txtCurrDesc" TextMode="SingleLine" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.CURR_DESC") %>'>
</asp:TextBox></td>
</tr>
<tr>
<td>Decimal Places</td>
<td><asp:TextBox ID="txtCurrDecimal" OnBlur="return checkMandatory('Currency Sign cannot be blank');" OnKeyUp="return validateRange();" TextMode="SingleLine" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.CURR_DECIMAL") %>'>
</asp:TextBox></td>
<td colspan="2"></td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:button id="btnUpdate" text="Update" runat="server" commandName="Update" Visible='<%# Not RadGrid1.MasterTableView.IsItemInserted %>' ></asp:button>
<asp:button id="btnInsert" text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>' ></asp:button>
<asp:button id="btnCancel" text="Cancel" runat="server" causesvalidation="False" commandname="Cancel"></asp:button></td>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>