1jaws
asked on
clickable column
This code below makes Name column in my grid all clickable and redirects, but what I need is only when loginPassword is null and ((bool)Session["Account"] == true)
I tried to put that in MakeLInk code below and I added this code but it only makes one row clickable even though I have two null password rows(records)
protected void RadGrid1_ItemDataBound(obj ect sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.AlternatingIt em ||
e.Item.ItemType == GridItemType.Item)
{
Password = DataBinder.Eval(e.Item.Dat aItem, "loginPassword").ToString( );
GridDataItem dataItem = (GridDataItem)e.Item;
if (Password == "")
SetPassword = "";
}
}
I tried to put that in MakeLInk code below and I added this code but it only makes one row clickable even though I have two null password rows(records)
protected void RadGrid1_ItemDataBound(obj
{
if (e.Item.ItemType == GridItemType.AlternatingIt
e.Item.ItemType == GridItemType.Item)
{
Password = DataBinder.Eval(e.Item.Dat
GridDataItem dataItem = (GridDataItem)e.Item;
if (Password == "")
SetPassword = "";
}
}
<radG:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="dsManager" ForeColor="#333333" GridLines="None"
Width="600px" OnItemCommand = "RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound"
>
<MasterTableView DataKeyNames="ID,displayName,loginPassword"
DataSourceID="dsManager" EditMode="InPlace">
<RowIndicatorColumn Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="False">
<HeaderStyle Width="19px" />
</ExpandCollapseColumn>
<Columns>
<radG:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/images/edit.gif" CommandName="Edit"
Text="Update" UniqueName="Edit" />
<radG:GridBoundColumn DataField="profileID" HeaderText="ID" SortExpression="ID"
UniqueName="ID" Visible="false">
</radG:GridBoundColumn>
<radG:GridTemplateColumn HeaderText="Name" UniqueName="displayName">
<ItemTemplate>
<%# MakeLink(Convert.ToString(DataBinder.Eval(Container.DataItem, "displayName")))%>
</ItemTemplate>
</radG:GridTemplateColumn>
<radG:GridTemplateColumn HeaderText="Password" SortExpression="loginPassword"
UniqueName="loginPassword">
<ItemTemplate>
<asp:Label runat="server" ID="lblloginPassword" Text='<%# new string(char.Parse("*"),Eval("loginPassword").ToString().Length) %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtlogin" TextMode="Password" value='<%# Eval("loginPassword") %>' ></asp:TextBox>
</EditItemTemplate>
</radG:GridTemplateColumn>
code behind
public string MakeLink(string displayName)
{
string returnValue;
if ((bool)Session["Account"] == true)
returnValue = "<a href='myaccount.aspx?ID=" + Session["ID"] + "' Target='_blank' >" + displayName + "</a>";
else
returnValue = " ";
return returnValue;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
actually, is it possible to not to make the else to return not that time name fields shows empty... I want that to show.. but not clickable that time...
You can just put the name instead.
ASKER
yes, I got it thanks..
ASKER