Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

clickable column

Avatar of 1jaws
1jawsFlag for United States of America asked on
.NET ProgrammingC#ASP.NET
5 Comments1 Solution466 ViewsLast Modified:
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(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.AlternatingItem ||
            e.Item.ItemType == GridItemType.Item)
        {

            Password = DataBinder.Eval(e.Item.DataItem, "loginPassword").ToString();

            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 = "&nbsp;";
        return returnValue;
    }
ASKER CERTIFIED SOLUTION
Avatar of Stephan
StephanFlag of Netherlands imageLead Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers