This is a migrated thread and some comments may be shown as answers.

Problem When Editing the record

3 Answers 289 Views
Getting started with ASP.NET
This is a migrated thread and some comments may be shown as answers.
Venki
Top achievements
Rank 1
Venki asked on 12 Apr 2007, 05:16 AM
Hi,

I am using radgrid control when i am try to edit its showing Only items with IsInEditMode set to true can be updated ,but i am not getting this property anywhere in the grid plz help me

3 Answers, 1 is accepted

Sort by
0
surfer
Top achievements
Rank 1
answered on 12 Apr 2007, 05:31 AM
IsInEditMode is a property of the row (Item) of the respective grid. You can check for it in the ItemDataBound event for example. Here is some sample code:

Protected Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.WebControls.GridItemEventArgs) Handles RadGrid1.ItemDataBound 
         If (TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode)Then 
             Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) 
             Dim editMan As GridEditManager = editedItem.EditManager 
 
             Dim editor As GridDropDownListColumnEditor = CType(editMan.GetColumnEditor("DropDownColumn"), GridDropDownListColumnEditor) 
             Dim ddList As DropDownList = editor.DropDownListControl 
            ddList.Items.Insert(0, New ListItem("Select Contact Title""NotSetItem")) 
            ddList.Items(0).Attributes( "style") = "color: red" 
         End If 
 
End Sub 

0
Venki
Top achievements
Rank 1
answered on 12 Apr 2007, 07:44 AM

hi surfer,

here i pasted my codebehind file and also aspx file please tell me where to check that ISINEDITMODE i tried in so many ways still its showing the same error

using System;

 

using System.Data;

 

using System.Configuration;

 

using System.Collections;

 

using System.Web;

 

using System.Web.Security;

 

using System.Web.UI;

 

using System.Web.UI.WebControls;

 

using System.Web.UI.WebControls.WebParts;

 

using System.Web.UI.HtmlControls;

 

using Telerik.WebControls;

 

using Masters;

 

public partial class Masters_UserMaster : System.Web.UI.Page

 

{

protected void Page_Load(object sender, EventArgs e)

{

//if (!IsPostBack)

 

//{

 

Masters.UserMaster um = new Masters.UserMaster();

ViewState["GridData"] = (DataTable)um.Fetch().Tables[0];

RadGrid1.DataSource = ViewState["GridData"];

um = null;

//}

 

//else

 

//{

 

// RadGrid1.DataSource = ViewState["GridData"];

 

//}

 

}

protected void RadGrid1_ItemUpdated(object source, GridUpdatedEventArgs e)

{

if (e.Exception != null)

{

e.KeepInEditMode = true;

e.ExceptionHandled = true;

}

}

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

{

 

Masters.UserMaster um = new Masters.UserMaster();

if (e.CommandName.ToString().Trim() == "insert")

{

TextBox txtFirstName = e.Item.FindControl("txtFirstName") as TextBox;

TextBox txtLastName = e.Item.FindControl("txtLastName") as TextBox;

TextBox txtNetworkID = e.Item.FindControl("txtNetworkID") as TextBox;

TextBox txtEmailID = e.Item.FindControl("txtEmailID") as TextBox;

DropDownList ddlSalute = e.Item.FindControl("ddlSalute") as DropDownList;

DropDownList ddlUserType = e.Item.FindControl("ddlUserType") as DropDownList;

 

if (txtFirstName != null) { um.prpFirstName = txtFirstName.Text.ToString().Trim(); }

if (txtLastName != null) { um.prpLastName = txtLastName.Text.ToString().Trim(); }

if (txtNetworkID != null) { um.prpNetworkID = txtNetworkID.Text.ToString().Trim(); }

if (txtEmailID != null) { um.prpEmailID = txtEmailID.Text.ToString().Trim(); }

if (ddlSalute != null) { um.prpSalute = ddlSalute.Text.ToString().Trim(); }

if (ddlUserType != null) { um.prpUserType = ddlUserType.Text.ToString().Trim(); }

um.prpCountryID = 1;

um.prpISPSR = true;

um.prpCreatedBy = "Upendra";

um.Save("i");

}

else if (e.CommandName.ToString().Trim() == "update")

{

TextBox txtFirstName = e.Item.FindControl("txtFirstName") as TextBox;

TextBox txtLastName = e.Item.FindControl("txtLastName") as TextBox;

TextBox txtNetworkID = e.Item.FindControl("txtNetworkID") as TextBox;

TextBox txtEmailID = e.Item.FindControl("txtEmailID") as TextBox;

DropDownList ddlSalute = e.Item.FindControl("ddlSalute") as DropDownList;

DropDownList ddlUserType = e.Item.FindControl("ddlUserType") as DropDownList;

 

if (txtFirstName != null) { um.prpFirstName = txtFirstName.Text.ToString().Trim(); }

if (txtLastName != null) { um.prpLastName = txtLastName.Text.ToString().Trim(); }

if (txtNetworkID != null) { um.prpNetworkID = txtNetworkID.Text.ToString().Trim(); }

if (txtEmailID != null) { um.prpEmailID = txtEmailID.Text.ToString().Trim(); }

if (ddlSalute != null) { um.prpSalute = ddlSalute.Text.ToString().Trim(); }

if (ddlUserType != null) { um.prpUserType = ddlUserType.Text.ToString().Trim(); }

//um.prpCountryID = 2;

 

//um.prpISPSR = false;

 

//um.prpModifiedBy = "Upen";

 

um.Save("u");

}

else if (e.CommandName.ToString().Trim() == "delete")

{

um.prpUserID = Int32.Parse(e.Item.Cells[5].Text);

string result = um.Delete();

}

if (e.CommandName == RadGrid.InitInsertCommandName)

{

e.Canceled = true;

//Prepare an IDictionary with the predefined values

 

System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();

newValues["Salute"] = "Mr.";

//Insert the item and rebind

 

e.Item.OwnerTableView.InsertItem(newValues);

GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");

editColumn.Visible = false;

}

// else

 

// {

 

// GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");

 

// if (!editColumn.Visible)

 

// editColumn.Visible = true;

 

//}

 

}

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

{

//Masters.UserMaster um = new Masters.UserMaster();

 

//ViewState["GridData"] = (DataTable)um.Fetch().Tables[0];

 

//RadGrid1.DataSource = ViewState["GridData"];

 

//um = null;

 

}

 

 

protected void Search_Click(object sender, EventArgs e)

{

Masters.UserMaster um = new Masters.UserMaster();

um.prpFirstName = txtCriteria.Text;

DataTable dtUser;

dtUser = (DataTable)um.Fetch().Tables[0];

if (dtUser.Rows.Count == 0)

{

Label1.Text = "Records Not Found";

}

else

 

{

RadGrid1.DataSource = dtUser;

RadGrid1.DataBind();

}

um = null;

}

protected void ClearSearch_Click(object sender, EventArgs e)

{

txtCriteria.Text = "";

Masters.UserMaster um = new Masters.UserMaster();

RadGrid1.DataSource = (DataTable)um.Fetch().Tables[0];

RadGrid1.DataBind();

um = null;

}

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)

{

if (e.Item is GridEditableItem && e.Item.IsInEditMode)

{

}

}

}

aspx file


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserMaster.aspx.cs" Inherits="Masters_UserMaster" %>

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<table Width="99%" id="table" >

<tr>

<asp:Label ID="Label1" runat="server" Width="99%" EnableViewState="False" Font-Bold="True" ></asp:Label></tr>

<tr bgcolor=Azure>

<td >

User Masters</td>

</tr>

<tr bgcolor="#ebedd5">

<td > FirstName </td>

<td>

<asp:DropDownList ID="ddlsearch" runat="server" >

<asp:ListItem>FirstName</asp:ListItem>

</asp:DropDownList></td>

<td> Criteria </td>

<td>

<asp:TextBox ID="txtCriteria" runat="server" ></asp:TextBox>

</td>

<td bordercolordark="green">

<asp:LinkButton ID="Search" runat="server" CommandName="Search" OnClick="Search_Click" ><img style="border:0px" alt="" src="../RadControls/Grid/Img/zoom.png" /> Search</asp:LinkButton>

</td>

<td >

<asp:LinkButton ID="ClearSearch" runat="server" CommandName="ClearSearch" BorderColor=Black OnClick="ClearSearch_Click"><img style="border:0px" alt="" src="../RadControls/Grid/Img/refresh.png" /> Clear Search</asp:LinkButton>

</td>

</tr>

</table>

<radG:RadGrid ID="RadGrid1" Skin="Outlook" runat="server" CssClass="RadGrid" GridLines="None" AllowPaging="True"

PageSize="6" AllowSorting="True" Width="99%" AllowMultiRowSelection="true" AutoGenerateColumns="False" EnableAJAX="True" ShowStatusBar="true" AlternatingItemStyle-BackColor=LightGoldenrodYellow

AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" SelectedItemStyle-BackColor=AliceBlue

HorizontalAlign="NotSet" LoadingTemplateTransparency="50" EnableAJAXLoadingTemplate="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemUpdated="RadGrid1_ItemUpdated" OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound">

<PagerStyle Mode="Slider"></PagerStyle>

<ClientSettings>

<Selecting AllowRowSelect="true" />

</ClientSettings>

<MasterTableView CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign=Right GridLines="None" DataKeyNames="UserID" AllowSorting="True" AllowFilteringByColumn="False">

<CommandItemTemplate>

<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Records?')"

runat="server" CommandName="DeleteSelected"><img style="border:0px" alt="" src="../RadControls/Grid/Img/Delete.gif" /> Delete Selected Records</asp:LinkButton>

<asp:LinkButton ID="LinkButton4"

runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../RadControls/Grid/Img/application_form_add.gif"/>Add New</asp:LinkButton>

</CommandItemTemplate>

<Columns>

<radG:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" EditText="Edit Record" EditImageUrl="../RadControls/Grid/Img/application_edit.png" >

<ItemStyle CssClass="btnico edit" />

</radG:GridEditCommandColumn>

<radG:GridButtonColumn ButtonType="ImageButton" ImageUrl="../RadControls/Grid/Img/Delete.gif" AutoPostBackOnFilter=true

CommandName="delete" Text="Delete Record" ConfirmText="Are You Sure To Delete This Record?" UniqueName="column" >

</radG:GridButtonColumn>

<radG:GridBoundColumn DataField="UserID" HeaderText="ID" ReadOnly="True" SortExpression="UserID"

UniqueName="UserID" Visible="false">

<HeaderStyle Width="20px" ForeColor="Silver" />

<ItemStyle ForeColor="Silver" />

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="Salute" HeaderText="Salute" DataField="Salute">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="LastName" HeaderText="LastName" DataField="LastName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="EmailID" HeaderText="EmailID" DataField="EmailID">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="NetworkID" HeaderText="NetworkID" DataField="NetworkID">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="UserType" HeaderText="UserType" DataField="UserType">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="IsPSR" HeaderText="Is PSR" DataField="IsPSR" >

</radG:GridBoundColumn>

</Columns>

<EditFormSettings EditFormType="Template">

<EditColumn UniqueName="EditCommandColumn1">

</EditColumn>

<FormTemplate>

<table id="Table2" cellspacing="2" cellpadding="1" width="250" border="1" rules="none"

style="border-collapse: collapse">

<tr class="EditFormHeader">

<td colspan="2">

<b>User Details</b></td>

</tr>

<tr>

<td>

<table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">

<tr>

<td>

</td>

<td>

</td>

</tr>

 

<tr>

<td>Salute:</td>

<td>

<asp:DropDownList ID="ddlSalute" runat="server" SelectedValue='<%# Bind("Salute") %>'

DataSource='<%# (new string[] { "Dr.", "Mr.", "Mrs.", "Ms." }) %>' TabIndex="7">

</asp:DropDownList></td>

<td>First Name:</td>

<td>

<asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind( "FirstName" ) %>'>

</asp:TextBox></td>

<td>Last Name:</td>

<td>

<asp:TextBox ID="txtLastName" runat="server" Text='<%# Bind( "LastName" ) %>'>

</asp:TextBox></td>

</tr>

<tr>

<td>NetWorkID:</td>

<td colspan="3">

<asp:TextBox ID="txtNetworkID" runat="server" Text='<%# Bind( "NetworkID" ) %>'>

</asp:TextBox></td>

<td>EmailID:</td>

<td>

<asp:TextBox ID="txtEmailID" runat="server" Text='<%# Bind( "EmailID" ) %>'>

</asp:TextBox></td>

</tr>

<tr>

<td colspan=3>Is PSR:</td>

<td>

<!--<asp:RadioButton ID=rd1 GroupName=RadiooG runat=server Text=Yes />

<asp:RadioButton ID=rd2 GroupName=RadiooG runat=server Text=No />-->

<!--<asp:RadioButtonList ID=IsPsr DataTextField=IsPSR DataValueField='<%# Bind( "IsPSR" ) %>' runat=server TextAlign=Right RepeatColumns=2>

</asp:RadioButtonList>-->

<asp:RadioButtonList ID=IsPsr2 runat=server TextAlign=Right RepeatColumns=2 RepeatDirection =Horizontal>

</asp:RadioButtonList>

</td>

<td>UserType:</td>

<td>

<asp:DropDownList ID="ddlUserType" runat="server" DataValueField=UserType DataTextField= '<%# Bind( "UserType" ) %>' >

<asp:ListItem>Regional Admin</asp:ListItem>

<asp:ListItem>Country</asp:ListItem>

<asp:ListItem>Normal</asp:ListItem>

</asp:DropDownList>

</td>

</tr>

</table>

<tr>

<td align="right" colspan="2">

<asp:ImageButton ID=img1 CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "insert" : "update" %>' runat=server ImageUrl="~/RadControls/Grid/Img/tick.gif" />

<asp:LinkButton ID="LinkButton2" runat="server" Text="Save"

CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "insert" : "update" %>'></asp:LinkButton>

<asp:ImageButton ID=img2 CommandName="Cancel" runat=server ImageUrl="../RadControls/Grid/Img/Cancel.gif" />

<asp:LinkButton ID="LinkButton3" runat="server" Text="Cancel" CommandName="Cancel" > </asp:LinkButton></td>

</tr>

</table>

 

</FormTemplate>

</EditFormSettings>

<ExpandCollapseColumn Visible="False">

<HeaderStyle Width="19px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</MasterTableView>

</radG:RadGrid>

</div>

</form>

</body>

</html>

0
Venki
Top achievements
Rank 1
answered on 12 Apr 2007, 08:39 AM

hi surfer,

here i pasted my codebehind file and also aspx file please tell me where to check that ISINEDITMODE i tried in so many ways still its showing the same error

using System;

 

using System.Data;

 

using System.Configuration;

 

using System.Collections;

 

using System.Web;

 

using System.Web.Security;

 

using System.Web.UI;

 

using System.Web.UI.WebControls;

 

using System.Web.UI.WebControls.WebParts;

 

using System.Web.UI.HtmlControls;

 

using Telerik.WebControls;

 

using Masters;

 

public partial class Masters_UserMaster : System.Web.UI.Page

 

{

protected void Page_Load(object sender, EventArgs e)

{

//if (!IsPostBack)

 

//{

 

Masters.UserMaster um = new Masters.UserMaster();

ViewState["GridData"] = (DataTable)um.Fetch().Tables[0];

RadGrid1.DataSource = ViewState["GridData"];

um = null;

//}

 

//else

 

//{

 

// RadGrid1.DataSource = ViewState["GridData"];

 

//}

 

}

protected void RadGrid1_ItemUpdated(object source, GridUpdatedEventArgs e)

{

if (e.Exception != null)

{

e.KeepInEditMode = true;

e.ExceptionHandled = true;

}

}

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

{

 

Masters.UserMaster um = new Masters.UserMaster();

if (e.CommandName.ToString().Trim() == "insert")

{

TextBox txtFirstName = e.Item.FindControl("txtFirstName") as TextBox;

TextBox txtLastName = e.Item.FindControl("txtLastName") as TextBox;

TextBox txtNetworkID = e.Item.FindControl("txtNetworkID") as TextBox;

TextBox txtEmailID = e.Item.FindControl("txtEmailID") as TextBox;

DropDownList ddlSalute = e.Item.FindControl("ddlSalute") as DropDownList;

DropDownList ddlUserType = e.Item.FindControl("ddlUserType") as DropDownList;

 

if (txtFirstName != null) { um.prpFirstName = txtFirstName.Text.ToString().Trim(); }

if (txtLastName != null) { um.prpLastName = txtLastName.Text.ToString().Trim(); }

if (txtNetworkID != null) { um.prpNetworkID = txtNetworkID.Text.ToString().Trim(); }

if (txtEmailID != null) { um.prpEmailID = txtEmailID.Text.ToString().Trim(); }

if (ddlSalute != null) { um.prpSalute = ddlSalute.Text.ToString().Trim(); }

if (ddlUserType != null) { um.prpUserType = ddlUserType.Text.ToString().Trim(); }

um.prpCountryID = 1;

um.prpISPSR = true;

um.prpCreatedBy = "Upendra";

um.Save("i");

}

else if (e.CommandName.ToString().Trim() == "update")

{

TextBox txtFirstName = e.Item.FindControl("txtFirstName") as TextBox;

TextBox txtLastName = e.Item.FindControl("txtLastName") as TextBox;

TextBox txtNetworkID = e.Item.FindControl("txtNetworkID") as TextBox;

TextBox txtEmailID = e.Item.FindControl("txtEmailID") as TextBox;

DropDownList ddlSalute = e.Item.FindControl("ddlSalute") as DropDownList;

DropDownList ddlUserType = e.Item.FindControl("ddlUserType") as DropDownList;

 

if (txtFirstName != null) { um.prpFirstName = txtFirstName.Text.ToString().Trim(); }

if (txtLastName != null) { um.prpLastName = txtLastName.Text.ToString().Trim(); }

if (txtNetworkID != null) { um.prpNetworkID = txtNetworkID.Text.ToString().Trim(); }

if (txtEmailID != null) { um.prpEmailID = txtEmailID.Text.ToString().Trim(); }

if (ddlSalute != null) { um.prpSalute = ddlSalute.Text.ToString().Trim(); }

if (ddlUserType != null) { um.prpUserType = ddlUserType.Text.ToString().Trim(); }

//um.prpCountryID = 2;

 

//um.prpISPSR = false;

 

//um.prpModifiedBy = "Upen";

 

um.Save("u");

}

else if (e.CommandName.ToString().Trim() == "delete")

{

um.prpUserID = Int32.Parse(e.Item.Cells[5].Text);

string result = um.Delete();

}

if (e.CommandName == RadGrid.InitInsertCommandName)

{

e.Canceled = true;

//Prepare an IDictionary with the predefined values

 

System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();

newValues["Salute"] = "Mr.";

//Insert the item and rebind

 

e.Item.OwnerTableView.InsertItem(newValues);

GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");

editColumn.Visible = false;

}

// else

 

// {

 

// GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");

 

// if (!editColumn.Visible)

 

// editColumn.Visible = true;

 

//}

 

}

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

{

//Masters.UserMaster um = new Masters.UserMaster();

 

//ViewState["GridData"] = (DataTable)um.Fetch().Tables[0];

 

//RadGrid1.DataSource = ViewState["GridData"];

 

//um = null;

 

}

 

 

protected void Search_Click(object sender, EventArgs e)

{

Masters.UserMaster um = new Masters.UserMaster();

um.prpFirstName = txtCriteria.Text;

DataTable dtUser;

dtUser = (DataTable)um.Fetch().Tables[0];

if (dtUser.Rows.Count == 0)

{

Label1.Text = "Records Not Found";

}

else

 

{

RadGrid1.DataSource = dtUser;

RadGrid1.DataBind();

}

um = null;

}

protected void ClearSearch_Click(object sender, EventArgs e)

{

txtCriteria.Text = "";

Masters.UserMaster um = new Masters.UserMaster();

RadGrid1.DataSource = (DataTable)um.Fetch().Tables[0];

RadGrid1.DataBind();

um = null;

}

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)

{

if (e.Item is GridEditableItem && e.Item.IsInEditMode)

{

}

}

}

aspx file


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserMaster.aspx.cs" Inherits="Masters_UserMaster" %>

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<table Width="99%" id="table" >

<tr>

<asp:Label ID="Label1" runat="server" Width="99%" EnableViewState="False" Font-Bold="True" ></asp:Label></tr>

<tr bgcolor=Azure>

<td >

User Masters</td>

</tr>

<tr bgcolor="#ebedd5">

<td > FirstName </td>

<td>

<asp:DropDownList ID="ddlsearch" runat="server" >

<asp:ListItem>FirstName</asp:ListItem>

</asp:DropDownList></td>

<td> Criteria </td>

<td>

<asp:TextBox ID="txtCriteria" runat="server" ></asp:TextBox>

</td>

<td bordercolordark="green">

<asp:LinkButton ID="Search" runat="server" CommandName="Search" OnClick="Search_Click" ><img style="border:0px" alt="" src="../RadControls/Grid/Img/zoom.png" /> Search</asp:LinkButton>

</td>

<td >

<asp:LinkButton ID="ClearSearch" runat="server" CommandName="ClearSearch" BorderColor=Black OnClick="ClearSearch_Click"><img style="border:0px" alt="" src="../RadControls/Grid/Img/refresh.png" /> Clear Search</asp:LinkButton>

</td>

</tr>

</table>

<radG:RadGrid ID="RadGrid1" Skin="Outlook" runat="server" CssClass="RadGrid" GridLines="None" AllowPaging="True"

PageSize="6" AllowSorting="True" Width="99%" AllowMultiRowSelection="true" AutoGenerateColumns="False" EnableAJAX="True" ShowStatusBar="true" AlternatingItemStyle-BackColor=LightGoldenrodYellow

AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" SelectedItemStyle-BackColor=AliceBlue

HorizontalAlign="NotSet" LoadingTemplateTransparency="50" EnableAJAXLoadingTemplate="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemUpdated="RadGrid1_ItemUpdated" OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound">

<PagerStyle Mode="Slider"></PagerStyle>

<ClientSettings>

<Selecting AllowRowSelect="true" />

</ClientSettings>

<MasterTableView CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign=Right GridLines="None" DataKeyNames="UserID" AllowSorting="True" AllowFilteringByColumn="False">

<CommandItemTemplate>

<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Records?')"

runat="server" CommandName="DeleteSelected"><img style="border:0px" alt="" src="../RadControls/Grid/Img/Delete.gif" /> Delete Selected Records</asp:LinkButton>

<asp:LinkButton ID="LinkButton4"

runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../RadControls/Grid/Img/application_form_add.gif"/>Add New</asp:LinkButton>

</CommandItemTemplate>

<Columns>

<radG:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" EditText="Edit Record" EditImageUrl="../RadControls/Grid/Img/application_edit.png" >

<ItemStyle CssClass="btnico edit" />

</radG:GridEditCommandColumn>

<radG:GridButtonColumn ButtonType="ImageButton" ImageUrl="../RadControls/Grid/Img/Delete.gif" AutoPostBackOnFilter=true

CommandName="delete" Text="Delete Record" ConfirmText="Are You Sure To Delete This Record?" UniqueName="column" >

</radG:GridButtonColumn>

<radG:GridBoundColumn DataField="UserID" HeaderText="ID" ReadOnly="True" SortExpression="UserID"

UniqueName="UserID" Visible="false">

<HeaderStyle Width="20px" ForeColor="Silver" />

<ItemStyle ForeColor="Silver" />

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="Salute" HeaderText="Salute" DataField="Salute">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="LastName" HeaderText="LastName" DataField="LastName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="EmailID" HeaderText="EmailID" DataField="EmailID">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="NetworkID" HeaderText="NetworkID" DataField="NetworkID">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="UserType" HeaderText="UserType" DataField="UserType">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="IsPSR" HeaderText="Is PSR" DataField="IsPSR" >

</radG:GridBoundColumn>

</Columns>

<EditFormSettings EditFormType="Template">

<EditColumn UniqueName="EditCommandColumn1">

</EditColumn>

<FormTemplate>

<table id="Table2" cellspacing="2" cellpadding="1" width="250" border="1" rules="none"

style="border-collapse: collapse">

<tr class="EditFormHeader">

<td colspan="2">

<b>User Details</b></td>

</tr>

<tr>

<td>

<table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">

<tr>

<td>

</td>

<td>

</td>

</tr>

 

<tr>

<td>Salute:</td>

<td>

<asp:DropDownList ID="ddlSalute" runat="server" SelectedValue='<%# Bind("Salute") %>'

DataSource='<%# (new string[] { "Dr.", "Mr.", "Mrs.", "Ms." }) %>' TabIndex="7">

</asp:DropDownList></td>

<td>First Name:</td>

<td>

<asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind( "FirstName" ) %>'>

</asp:TextBox></td>

<td>Last Name:</td>

<td>

<asp:TextBox ID="txtLastName" runat="server" Text='<%# Bind( "LastName" ) %>'>

</asp:TextBox></td>

</tr>

<tr>

<td>NetWorkID:</td>

<td colspan="3">

<asp:TextBox ID="txtNetworkID" runat="server" Text='<%# Bind( "NetworkID" ) %>'>

</asp:TextBox></td>

<td>EmailID:</td>

<td>

<asp:TextBox ID="txtEmailID" runat="server" Text='<%# Bind( "EmailID" ) %>'>

</asp:TextBox></td>

</tr>

<tr>

<td colspan=3>Is PSR:</td>

<td>

<!--<asp:RadioButton ID=rd1 GroupName=RadiooG runat=server Text=Yes />

<asp:RadioButton ID=rd2 GroupName=RadiooG runat=server Text=No />-->

<!--<asp:RadioButtonList ID=IsPsr DataTextField=IsPSR DataValueField='<%# Bind( "IsPSR" ) %>' runat=server TextAlign=Right RepeatColumns=2>

</asp:RadioButtonList>-->

<asp:RadioButtonList ID=IsPsr2 runat=server TextAlign=Right RepeatColumns=2 RepeatDirection =Horizontal>

</asp:RadioButtonList>

</td>

<td>UserType:</td>

<td>

<asp:DropDownList ID="ddlUserType" runat="server" DataValueField=UserType DataTextField= '<%# Bind( "UserType" ) %>' >

<asp:ListItem>Regional Admin</asp:ListItem>

<asp:ListItem>Country</asp:ListItem>

<asp:ListItem>Normal</asp:ListItem>

</asp:DropDownList>

</td>

</tr>

</table>

<tr>

<td align="right" colspan="2">

<asp:ImageButton ID=img1 CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "insert" : "update" %>' runat=server ImageUrl="~/RadControls/Grid/Img/tick.gif" />

<asp:LinkButton ID="LinkButton2" runat="server" Text="Save"

CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "insert" : "update" %>'></asp:LinkButton>

<asp:ImageButton ID=img2 CommandName="Cancel" runat=server ImageUrl="../RadControls/Grid/Img/Cancel.gif" />

<asp:LinkButton ID="LinkButton3" runat="server" Text="Cancel" CommandName="Cancel" > </asp:LinkButton></td>

</tr>

</table>

 

</FormTemplate>

</EditFormSettings>

<ExpandCollapseColumn Visible="False">

<HeaderStyle Width="19px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</MasterTableView>

</radG:RadGrid>

</div>

</form>

</body>

</html>

Tags
Getting started with ASP.NET
Asked by
Venki
Top achievements
Rank 1
Answers by
surfer
Top achievements
Rank 1
Venki
Top achievements
Rank 1
Share this question
or