Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Add New Row Using RowEditingTemplate
posted

Infragistics45.Web.v14.1, Version=14.1.20141.2283

I have a WebDataGrid that uses RowEditingTemplate for update. The data source and data bind happen in the code behind. I am doing manual CRUD in the code behind as well. The update is working beautifully.  I would like the grid to do the same thing for adding a new roll using the RowEditingTemplate. I want to click the top of the grid to open up the EditingTemplete and I would like to do manual insert to the database in the code behind.

Can you please help?

Thanks in advance!

Wendy


<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" DataKeyFields="ConfereeId" Height="400px" Width="1000px" OnRowUpdating="WebDataGrid1_RowUpdating">

<Columns>
<ig:BoundDataField DataFieldName="ConfereeId" Key="ConfereeId">
<Header Text="ConfereeId">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="LastName" Key="LastName">
<Header Text="LastName">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="FirstName" Key="FirstName">
<Header Text="FirstName">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="MiddleInitial" Key="MiddleInitial">
<Header Text="MiddleInitial">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="MembershipCateg" Key="MembershipCateg">
<Header Text="MembershipCateg">
</Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="EntryDate" Key="EntryDate" Hidden="True">
<Header Text="EntryDate">
</Header>
</ig:BoundDataField>
</Columns>
<AjaxIndicator Enabled="True" BlockArea="Control" BlockCssClass="ig_AjaxIndicatorBlock" ImageUrl="~/ig_res/Default/images/ig_ajaxIndicator.gif" Location="MiddleCenter" RelativeToControl="True" />
<Behaviors>
<ig:Activation Enabled="true">
</ig:Activation>
<ig:Selection CellClickAction="Row" RowSelectType="Single" Enabled="true">
</ig:Selection>
<ig:Sorting></ig:Sorting>
<ig:EditingCore>
<Behaviors>
<ig:RowEditingTemplate CancelButton="buttonCancel" OKButton="buttonOK" RowEditingClientEvents-TemplateClosed="Closed">
<EditModeActions EnableF2="true" MouseClick="Double" />
<ClientBindings>
<ig:RowEditingClientBinding ColumnKey="MembershipCateg" ControlID="wbdMembershipCateg" GetValueJavaScript="$find({ClientID}).get_currentValue()"
SetValueJavaScript="$find({ClientID}).set_currentValue({value},true)" />
<ig:RowEditingClientBinding ColumnKey="FirstName" ControlID="tbFirstName" GetValueJavaScript="$get({ClientID}).value"
SetValueJavaScript="$get({ClientID}).value={value}" />
<ig:RowEditingClientBinding ColumnKey="MiddleInitial" ControlID="tbMiddleInitial" GetValueJavaScript="$get({ClientID}).value"
SetValueJavaScript="$get({ClientID}).value={value}" />
<ig:RowEditingClientBinding ColumnKey="LastName" ControlID="tbLastName" GetValueJavaScript="$get({ClientID}).value"
SetValueJavaScript="$get({ClientID}).value={value}" />
<ig:RowEditingClientBinding ColumnKey="EntryDate" ControlID="WebDatePicker1" GetValueJavaScript="$find({ClientID}).get_value()"
SetValueJavaScript="$find({ClientID}).set_value({value})" />
</ClientBindings>

<RowEditingClientEvents TemplateClosed="Closed"></RowEditingClientEvents>
<Template>
<div style="background-color: white; border: 1px solid black;">
<table border="0" class="customEditRowTable">
<tr>
<td>
<asp:Label ID="LabelMembershipCateg" runat="server" Text="MembershipCateg" />
</td>
<td>
<ig:WebDropDown ID="wbdMembershipCateg" runat="server" Width="75px" DataSourceID="SqlDataSource1" TextField="ShortDesc" DataKeyFields="ShortDesc" ValueField="ShortDesc"></ig:WebDropDown>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="First Name" />
</td>
<td>
<asp:TextBox ID="tbFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Middle Initial" />
</td>
<td>
<asp:TextBox ID="tbMiddleInitial" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="Last Name" />
</td>
<td>
<asp:TextBox ID="tbLastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" Text="EntryDate" />
</td>
<td>
<ig:WebDatePicker ID="WebDatePicker1" runat="server" DisplayModeFormat="MM/dd/yyyy" Nullable="True" EnableWeekNumbers="true" ChangeMonthToDateClicked="true" EnableMonthDropDown="True" EnableYearDropDown="True" OpenCalendarOnFocus="true" DropDownCalendarID="WebMonthCalendar1" EditModeFormat="MM/dd/yyyy" NullText="Please enter a date">
</ig:WebDatePicker>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK"
UseSubmitBehavior="False" />&nbsp;
<asp:Button ID="buttonCancel" runat="server" CausesValidation="False" OnClientClick="return"
Text="Cancel" UseSubmitBehavior="False" />
</td>
</tr>
</table>
</div>
</Template>
</ig:RowEditingTemplate>
<ig:RowAdding Alignment="Top"></ig:RowAdding>
</Behaviors>
</ig:EditingCore>


<ig:Filtering AnimationEnabled="True" UniqueValueCasing="Camel">
</ig:Filtering>
</Behaviors>
</ig:WebDataGrid>
<ig:WebMonthCalendar ID="WebMonthCalendar1" runat="server"></ig:WebMonthCalendar>

<script language="javascript" type="text/javascript">
var isInEditMode = false;

function Closed() {
isInEditMode = false;
}
</script>



  • 20255
    Suggested Answer
    Offline posted

    Hello wendybaker,

     Thank you for contacting us!

     After some research, "Row Adding Template similar to RowEditing Template" has been determined to be a new product idea. The same product idea has already been submitted here < link> .As a member of the Infragistics Community you can vote for the features and suggestions you want to see added to the products, resulting in the most popular features bubbling up to the top. When planning new releases, our Product Management team will look at the most popular features and use your feedback to prioritize upcoming work.

    There are many benefits to submitting/ voting for an idea through UserVoice:

    - Communicate directly with our product management team. They'll see the idea described in your words and respond to you personally.
    - Receive notifications whenever new information regarding your idea becomes available.
    - Vote on your favorite product ideas to let us know which ones are the most important to you.
    - You and other developers can discuss existing product ideas with members of our Product Management team.

    Reference:

    http://ideas.infragistics.com/forums/192360-asp-net/suggestions/4317474-provide-a-row-adding-template-similar-to-row-editi

    Thank you for your request.