?
Solved

I want to display output in bold for the rows in data grid for the criteria (Indexvalue= empty and Index required =yes Look for Stored procedure and ASPx pages for details)

Posted on 2004-08-27
38
Medium Priority
?
509 Views
Last Modified: 2012-06-21
Please help me add the code for the displaying records in bold for the criteria (Indexvalue= empty and Index required =yes) from the database(See Stored procedure below.
I am attaching a relative ASPX code, Code behind the data grid and Stored procedure. I thought of adding SelectedindexChanged BUT i AM NOT SURE,
Can you please provide me the code to display the out put values in bold for the criteria or Should I write a new SP for displying output or use an existing one.
May be this request is simple, I am making it complicated.
'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ASPX code
<asp:datagrid CssClass="ReportTable" id="dgIndexValue" runat="server" AutoGenerateColumns="False"
                                          OnItemDataBound="dgIndexValue_ItemDataBound" AllowSorting="True" OnPageIndexChanged="Page_IndexChanged"
                                          OnItemCreated="dgIndexValue_ItemCreated" OnSortCommand="Page_SortCommand" OnDeleteCommand="dgIndexValue_DeleteCommand"
                                          OnEditCommand="dgIndexValue_EditCommand" OnCancelCommand="dgIndexValue_CancelCommand" OnUpdateCommand="dgIndexValue_UpdateCommand"
                                          ShowHeader="True" ShowFooter="false" PagerStyle-CssClass="ReportTablePager" HeaderStyle-CssClass="ReportTableHeader"
                                          FooterStyle-CssClass="ReportTableFooter" AlternatingItemStyle-CssClass="ReportTableAlternate"
                                          SelectedItemStyle-CssClass="ReportTableSelected" OnItemCommand="dgIndexValue_ItemCommand">
                                          <Columns>
                                                <asp:BoundColumn DataField="IndexValueID" ReadOnly="True" Visible="False" HeaderText="Index Value ID" />
                                                <asp:BoundColumn DataField="IndexType" ReadOnly="True" Visible="False" HeaderText="Index Type" />
                                                <asp:BoundColumn DataField="IndexName" ReadOnly="True" HeaderText="Name"></asp:BoundColumn>
                                                <asp:TemplateColumn HeaderText="Value">
                                                      <ItemTemplate>            
                                                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>' ID="Label2"/>
                                                      </ItemTemplate>
                                                                                                                                                      </Columns>
                                    </asp:datagrid>
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code Behind datagrid
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      public ICollection CreateIndexValueDataSource()
            {
                  DataView dv = null;
                  if (Request.QueryString["DocID"] != null)
                  {
                        DataSet ds = null;
                        try
                        {
                              SqlParameter [] param=new SqlParameter[1];
                              param[0] = new SqlParameter("@DocID",Convert.ToInt64(Request.QueryString["DocID"]));
                              ds = provider.FillDataSet("usp_IndexValueGetByDocID",param);
                              dv =  ds.Tables[0].DefaultView;
                              
                        }                        
                        catch(Exception ex)
                        {
                              lblError.Text = ex.Message;
                              lblError.Visible = true;
                        }
                        finally
                        {
                              if (ds != null)
                              {
                                    ds.Dispose();
                              }
                              ds = null;
                        }
                  }
                  return dv;//only null if errors occur
            }

private void Page_Load(object sender, System.EventArgs e)
            {
                  
                  SecurityAccess sa = new SecurityAccess();
                  if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Read", "", ""))
                  {
                        if (Request["DocID"]!=null && Convert.ToInt32(Request["DocID"])>0)
                        {
                              dgDoc.Visible = true;
                              dgIndexValue.Visible = true;
                        }
                        else
                        {
                              dgDoc.Visible = false;
                              dgIndexValue.Visible = false;
                        }


                        if (!IsPostBack)
                        {
                              dgDoc.DataSource = CreateDocumentDataSource();
                              dgDoc.DataBind();

                              dgIndexValue.DataSource = CreateIndexValueDataSource();
                              dgIndexValue.DataBind();
                                                                                //dgIndexValue.SelectedIndexChanged =                                             //I Think we need to add something here to display the records in bold for the Index values empty and Index rewuired =Null (See Stored procedure for details)
                        }


                        // Check security access
                        if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Write", "", ""))
                        {
                              dgDoc.Columns[10].Visible = true;
                              dgIndexValue.Columns[5].Visible = true;
                        }
                        else
                        {
                              dgDoc.Columns[10].Visible = false;
                              dgIndexValue.Columns[5].Visible = false;
                        }
                  }
                  else
                  {
                        Response.Redirect("Login.aspx");
                  }
            }
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Stored procedure for displaying records


CREATE    PROCEDURE usp_IndexValueGetByDocID
(
       @DocID INT
) AS


SET NOCOUNT ON
SELECT
      IVA.DocID,
      IVA.IndexValueID,
      IVA.IndexNameID,
      INACol.IndexName,
      IT.IndexType,
      dbo.udf_IndexValue(INACol.IndexTypeID, IVA.StringVal, IVA.IntVal, IVA.FloatVal, IVA.DateVal) AS IndexVal,
      IVA.CreateDate,
      IVA.CreatedBy,
      IVA.ModifyDate,
      IVA.ModifiedBy,
      INACol.Editable
FROM tb_IndexValue IVA
INNER JOIN tb_IndexName INACol ON INACol.IndexNameID = IVA.IndexNameID
INNER JOIN tb_IndexType IT ON INACol.IndexTypeID = IT.IndexTypeID
WHERE IVA.DocID = @DocID
AND INACol.Editable = 1
GO
'---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Should I change the SP to add Index required column in tb_Index value table = "yes" and dbo.udf_IndexValue(INACol.IndexTypeID, IVA.StringVal, IVA.IntVal, IVA.FloatVal, IVA.DateVal) AS IndexVal is equal to Null
or should I write a sub select statement.

Please help me . i'll appreciate your help
Thanks
Nirja
0
Comment
Question by:nirjabhim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 23
  • 15
38 Comments
 
LVL 10

Expert Comment

by:jnhorst
ID: 11919473
Nirja:

In the OnItemDataBound event:

if (e.Item.ItemType != ItemType.Hedaer && e.Item.ItemType != ItemType.Footer)
{
     // resolve the label that shows the IndexVal, which looks like it is at column index #3 in the datagrid from your aspx page.
     // "Label2" is the argument because it is the id of the label as defined in the aspx page in the datagrid's template column.
     // It would be better to name this something like "lblIdxVal" and use that in FindControl().
     Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("Label2");

     // you do not have a databound column for IndexRequired in your aspx datagrid.  add one at the end of the gird and set its
     // visible property to false.  this will become column index #4.  Resolve its value to a string variable as follows:
     string idxReq = e.Item.Cells(4).Text;

     // test these two values.
     if (lblIdxVal.Text = "" && idxReq == "Yes")
     {
          // if the index value is an empty string and the index is required, show each field in bold.
          e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
          e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
          e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
          lblIdxVal.Font.Bold = true;
     }
}

The OnItemDataBound event will fire for the header, each item and the footer.  This code will skip over the header and footer, and then
examine each item for the two criteria values and if they meet the criteria, add the <b> and </b> tags to the texts of the regular columns
and set the Bold property for the Template Column that has the Label.

Good luck!

John
0
 

Author Comment

by:nirjabhim
ID: 11921427
JOHN,
Can you please help me where to put that code in code page and ASPx page. I added Indexrequired column in stored procedure now.
Thanks  a lot for your response. Do I need to change the asp data grid. Can you please tell me what is findcontrol()
Please help me John. i am new to this .Net. I am suppoting the application.
I'll really appreciate your help.

Thanks
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11921616
John,
I added the as the method(ModifyFontDatasource) in populates section like this below and in the page load i included like shown below and also added databoundcloumn Indexrequired and changed the label from label2 to lblIdxVal as shown below. Please tell me wheather I am doing right or wrong?
      public ICollection ModifyFontDatasource()
            {
                  if (e.Item.ItemType != ItemType.Header && e.Item.ItemType != ItemType.Footer)
                                    {
                                          // resolve the label that shows the IndexVal, which looks like it is at column index #3 in the datagrid from your aspx page.
                                          // "Label2" is the argument because it is the id of the label as defined in the aspx page in the datagrid's template column.
                                          // It would be better to name this something like "lblIdxVal" and use that in FindControl().
                                          Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

                                          // you do not have a databound column for IndexRequired in your aspx datagrid.  add one at the end of the gird and set its
                                          // visible property to false.  this will become column index #4.  Resolve its value to a string variable as follows:
                                          string IndexRequired = e.Item.Cells(4).Text;

                                          // test these two values.
                                          if (lblIdxVal.Text = "" && IndexRequired == 1)
                                          {
                                                // if the index value is an empty string and the index is required, show each field in bold.
                                                e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
                                                e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
                                                e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
                                                lblIdxVal.Font.Bold = true;
                                          }
                         }
            }
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Page load method
private void Page_Load(object sender, System.EventArgs e)
          {
               
               SecurityAccess sa = new SecurityAccess();
               if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Read", "", ""))
               {
                    if (Request["DocID"]!=null && Convert.ToInt32(Request["DocID"])>0)
                    {
                         dgDoc.Visible = true;
                         dgIndexValue.Visible = true;
                    }
                    else
                    {
                         dgDoc.Visible = false;
                         dgIndexValue.Visible = false;
                    }


                    if (!IsPostBack)
                    {
                         dgDoc.DataSource = CreateDocumentDataSource();
                         dgDoc.DataBind();

                         dgIndexValue.DataSource = CreateIndexValueDataSource();
                         dgIndexValue.DataBind();
                         dgIndexValue.ItemDataBound = ModifyFontDatasource();                              I changed here to add ItemDatabound to the method I added.
                    }


                    // Check security access
                    if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Write", "", ""))
                    {
                         dgDoc.Columns[10].Visible = true;
                         dgIndexValue.Columns[5].Visible = true;
                    }
                    else
                    {
                         dgDoc.Columns[10].Visible = false;
                         dgIndexValue.Columns[5].Visible = false;
                    }
               }
               else
               {
                    Response.Redirect("Login.aspx");
               }
          }
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ASpx page data grid

<asp:datagrid CssClass="ReportTable" id="dgIndexValue" runat="server" AutoGenerateColumns="False"
                                          OnItemDataBound="dgIndexValue_ItemDataBound" AllowSorting="True" OnPageIndexChanged="Page_IndexChanged"
                                          OnItemCreated="dgIndexValue_ItemCreated" OnSortCommand="Page_SortCommand" OnDeleteCommand="dgIndexValue_DeleteCommand"
                                          OnEditCommand="dgIndexValue_EditCommand" OnCancelCommand="dgIndexValue_CancelCommand" OnUpdateCommand="dgIndexValue_UpdateCommand"
                                          ShowHeader="True" ShowFooter="false" PagerStyle-CssClass="ReportTablePager" HeaderStyle-CssClass="ReportTableHeader"
                                          FooterStyle-CssClass="ReportTableFooter" AlternatingItemStyle-CssClass="ReportTableAlternate"
                                          SelectedItemStyle-CssClass="ReportTableSelected" OnItemCommand="dgIndexValue_ItemCommand">
                                          <Columns>
                                                <asp:BoundColumn DataField="IndexValueID" ReadOnly="True" Visible="False" HeaderText="Index Value ID" />
                                                <asp:BoundColumn DataField="IndexType" ReadOnly="True" Visible="False" HeaderText="Index Type" />
                                                <asp:BoundColumn DataField="IndexName" ReadOnly="True" HeaderText="Name"></asp:BoundColumn>
                                                <asp:TemplateColumn HeaderText="Value">
                                                      <ItemTemplate>            
                                                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>' ID="lblIdxVal"/>
                                                      </ItemTemplate>
                                                      <FooterTemplate>
                                                            <asp:Button Text="Add" CommandName="Insert" Runat="server" ID="Button1"></asp:Button>
                                                      </FooterTemplate>
                                                      <EditItemTemplate>
                                                            <asp:TextBox runat="server" ID="EditIndexVal" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>'/>
                                                            <asp:RegularExpressionValidator id="IndexValRegEx" runat="server" ControlToValidate="EditIndexVal" ValidationExpression=".*"
                                                                  ErrorMessage="Your entry is not valid." display="dynamic" />
                                                            <asp:RequiredFieldValidator runat="server" id="IndexValReq" ControlToValidate="EditIndexVal" ErrorMessage="*" />
                                                      </EditItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:BoundColumn DataField="Editable" Visible="False" HeaderText="Editable" />
                                                <asp:BoundColumn DataField="IndexRequired" Visible="False" HeaderText="IndexRequired" />
                                                <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                                          </Columns>
                                    </asp:datagrid>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Stored procedure
CREATE    PROCEDURE usp_IndexValueGetByDocID
(
       @DocID INT
) AS

SET NOCOUNT ON
SELECT
      IVA.DocID,
      IVA.IndexValueID,
      IVA.IndexNameID,
      INACol.IndexName,
      INACol.IndexRequired,
      IT.IndexType,
      dbo.udf_IndexValue(INACol.IndexTypeID, IVA.StringVal, IVA.IntVal, IVA.FloatVal, IVA.DateVal) AS IndexVal,
      IVA.CreateDate,
      IVA.CreatedBy,
      IVA.ModifyDate,
      IVA.ModifiedBy,
      INACol.Editable
FROM tb_IndexValue IVA
INNER JOIN tb_IndexName INACol ON INACol.IndexNameID = IVA.IndexNameID
INNER JOIN tb_IndexType IT ON INACol.IndexTypeID = IT.IndexTypeID
WHERE IVA.DocID = @DocID
AND INACol.Editable = 1
GO

Please help me where to put your code in all these pages. I'll appreciate yor any help on these.
Thanks
Nirja

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:jnhorst
ID: 11923249
You have specified the dgIndexValue_ItemDataBound() routine as the handler for the OnItemDataBound event.  This is where the code I provided in my first post should go.  I'll repost the code here with adjustments based on your code:

**********code**************
if (e.Item.ItemType != ItemType.Hedaer && e.Item.ItemType != ItemType.Footer)
{
     // you changed the name of the label accordingly, and it looks like it is still in column #3 (the templated column).
     Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

     // you added a number of columns, with index rquired looking like it is column index #5.
     string idxReq = e.Item.Cells(5).Text;

     // test these two values.
     if (lblIdxVal.Text = "" && idxReq == "Yes")
     {
          // if the index value is an empty string and the index is required, show each field in bold.
          e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
          e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
          e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
          lblIdxVal.Font.Bold = true;
     }
}
*****************end code***********************

From what I see in your Page_Load routine, this line might be a problem:
dgIndexValue.ItemDataBound = ModifyFontDatasource();

In your aspx page, your datagrid has this attribute:
OnItemDataBound="dgIndexValue_ItemDataBound"

Thus you do not need a ModifyFontDatasource() routine for the code I provided.  There should be a routine like this:

private void dgIndexValue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
     ... my code above goes here.
}

In any event, there's no reason for a method returning an object compliant with the ICollection interface.

If that routine above does not appear, go to the page designer, click the grid, show the properties for the grid, and in the properties window
will be a button at the top with a lighting bolt icon.  Click this to show the grid's events.  Type "dgIndexValue_ItemDataBound" in the
box next to ItemDataBound and then tab out of the properties window.  The empty routine should be created for you.

You asked about FindControl():  One of the foundational classes for WebControls is the Control class.  Many controls have the capability
of containing other controls.  As an example, a table control contains table row controls.  A table row control contains table cell controls.
A table cell control might contain a label control,  a checkbox control, a textbox control, or whatever you might put into a table cell.
In your case, you have a column in your datagrid that has a label control that will display the index value.  If you need to manipulate this
display for one row but not the others (like make it bold), you need a way to get to the Label that shows the value.  Since the Label is within
the Cell, which in turn is within the Item, you resolve down to that Cell and then call the Cell's FindControl() method with the name of the
Label in the argument, and cast the Control that is returned as a Label control in order to set the Font.Bold = true property.  I'll parse each part of
the code:

e: (this is returned by the ItemDataBound event as an argument that gives you access to information about the event.

e.Item: since we are talking about the ItemDataBound event, this is the DataGridItem that has been bound to the datasource, but not yet
rendered as HTML for your browser.

e.Item.Cells: the DataGridItem class inherits from the TableRow class, and so has a Cells collection that refers to the table cells in the row.

e.Item.Cells(x): since Cells is a collection, it has an "indexer" that allows you to access any member of the collection by specifying the index.
This means if x=0, you will get the first cell, x=1 is the second cell, x=2 the third, and so on.  If you had 4 cells (0,1,2 and 3), and then tried to
call e.Item.Cells(4)... you would get an "index out of bounds" exception because you do not have a fifth cell in the collection.

e.Item.Cells(x).FindControl("controlName"): since you have a label control in your table cell (the column of the datagrid), by providing the id name
you gave to the label, the FindControl method will return to you an instance of the Control class representing that label.

(Label)e.Item.Cells(x).FindControl("controlName"): by putting "(Label)" before the code, you are telling the runtime to convert the Control returned
by FindControl to an instance of a Label class, by which you can then get the properties and other info about that label.

It looks like you are making things a little more complex than needed with your reference to ICollection.  Just define the name for the ItemDataBound
event as shown above (if that has not already been done) and put the code I provided in that event and it should do what you originally asked.

John
0
 

Author Comment

by:nirjabhim
ID: 11923932
John,
Thanks a lot for your response.
When I inser this code, I am getting error in the line
private void dgIndexValue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

            {
                  if (e.Item.ItemType != ItemType.Header && e.Item.ItemType != ItemType.Footer)
                  {
                        // resolve the label that shows the IndexVal, which looks like it is at column index #3 in the datagrid from your aspx page.
                        // "Label2" is the argument because it is the id of the label as defined in the aspx page in the datagrid's template column.
                        // It would be better to name this something like "lblIdxVal" and use that in FindControl().
                        Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

                        // you do not have a databound column for IndexRequired in your aspx datagrid.  add one at the end of the gird and set its
                        // visible property to false.  this will become column index #4.  Resolve its value to a string variable as follows:
                        string IndexRequired = e.Item.Cells(4).Text;
                  }

                  // test these two values.
                  if (lblIdxVal.Text = "" && IndexRequired == 1)
                  {
                        // if the index value is an empty string and the index is required, show each field in bold.
                        e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
                        e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
                        e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
                        lblIdxVal.Font.Bold = true;
                  }
            }
I am getting error in the first line 584 ie.Private void private void dgIndexValue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
The error description
c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(584): Class 'NotreDame.DocMaint' already defines a member called 'dgIndexValue_ItemDataBound' with the same parameter types

The only places I have the is in ASPx page
<asp:datagrid CssClass="ReportTable" id="dgIndexValue" runat="server" AutoGenerateColumns="False"
                                          OnItemDataBound="dgIndexValue_ItemDataBound" AllowSorting="True" OnPageIndexChanged="Page_IndexChanged"
                                          OnItemCreated="dgIndexValue_ItemCreated" OnSortCommand="Page_SortCommand" OnDeleteCommand="dgIndexValue_DeleteCommand"
                                          OnEditCommand="dgIndexValue_EditCommand" OnCancelCommand="dgIndexValue_CancelCommand" OnUpdateCommand="dgIndexValue_UpdateCommand"
                                          ShowHeader="True" ShowFooter="false" PagerStyle-CssClass="ReportTablePager" HeaderStyle-CssClass="ReportTableHeader"
                                          FooterStyle-CssClass="ReportTableFooter" AlternatingItemStyle-CssClass="ReportTableAlternate"
                                          SelectedItemStyle-CssClass="ReportTableSelected" OnItemCommand="dgIndexValue_ItemCommand">
and other one is I created is here
private void dgIndexValue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

How should I perform this. should I take away from aspx page
Can you pllease help me resolve this issue
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11924073
John,
Now i resolved that error with same name dgindexvalue_ItemDataBound now i am getting different error.
The line is if (e.Item.ItemType != ItemType.Header && e.Item.ItemType != ItemType.Footer) when I put a cursor after ItemType, I do not see the Header from the dropdown. I only see these from dropdown Assembly,Kit Adjustable,KitStandard,KitContinuty,StandaloneSKU

Please help me with this line,
I'll apprecite your help
Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11924117
Nirja:

My fault:  ItemType.Header/ItemType.Footer should be ListItemType.Header and ListItemType.Footer.

Sorry about that.

John
0
 

Author Comment

by:nirjabhim
ID: 11924158
Thanks for your reply
I resolved that error. Now I do not know what's happenening here.
I think it is failing here now in this line

Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

below is the whole code here
private void dgIndexvalue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
            {
                  if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
                  {
                        // resolve the label that shows the IndexVal, which looks like it is at column index #3 in the datagrid from your aspx page.
                        // "Label2" is the argument because it is the id of the label as defined in the aspx page in the datagrid's template column.
                        // It would be better to name this something like "lblIdxVal" and use that in FindControl().
                        Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

                        // you do not have a databound column for IndexRequired in your aspx datagrid.  add one at the end of the gird and set its
                        // visible property to false.  this will become column index #4.  Resolve its value to a string variable as follows:
                        string IndexRequired = e.Item.Cells(5).Text;
                  }

            // test these two values.
                  if (lblIdxVal.Text = "" && IndexRequired == 1)
                  {
                        // if the index value is an empty string and the index is required, show each field in bold.
                        e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
                        e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
                        e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
                        lblIdxVal.Font.Bold = true;
                  }
            }

and ASpx grid control code
      <asp:datagrid CssClass="ReportTable" id="dgIndexValue" runat="server" AutoGenerateColumns="False"
                                          OnItemDataBound="dgIndexValue_ItemDataBound" AllowSorting="True" OnPageIndexChanged="Page_IndexChanged"
                                          OnItemCreated="dgIndexValue_ItemCreated" OnSortCommand="Page_SortCommand" OnDeleteCommand="dgIndexValue_DeleteCommand"
                                          OnEditCommand="dgIndexValue_EditCommand" OnCancelCommand="dgIndexValue_CancelCommand" OnUpdateCommand="dgIndexValue_UpdateCommand"
                                          ShowHeader="True" ShowFooter="false" PagerStyle-CssClass="ReportTablePager" HeaderStyle-CssClass="ReportTableHeader"
                                          FooterStyle-CssClass="ReportTableFooter" AlternatingItemStyle-CssClass="ReportTableAlternate"
                                          SelectedItemStyle-CssClass="ReportTableSelected" OnItemCommand="dgIndexValue_ItemCommand">
                                          <Columns>
                                                <asp:BoundColumn DataField="IndexValueID" ReadOnly="True" Visible="False" HeaderText="Index Value ID" />
                                                <asp:BoundColumn DataField="IndexType" ReadOnly="True" Visible="False" HeaderText="Index Type" />
                                                <asp:BoundColumn DataField="IndexName" ReadOnly="True" HeaderText="Name"></asp:BoundColumn>
                                                <asp:TemplateColumn HeaderText="Value">
                                                      <ItemTemplate>
                                                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>' ID="lblIdxVal"/>
                                                      </ItemTemplate>
                                                      <FooterTemplate>
                                                            <asp:Button Text="Add" CommandName="Insert" Runat="server" ID="Button1"></asp:Button>
                                                      </FooterTemplate>
                                                      <EditItemTemplate>
                                                            <asp:TextBox runat="server" ID="EditIndexVal" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>'/>
                                                            <asp:RegularExpressionValidator id="IndexValRegEx" runat="server" ControlToValidate="EditIndexVal" ValidationExpression=".*"
                                                                  ErrorMessage="Your entry is not valid." display="dynamic" />
                                                            <asp:RequiredFieldValidator runat="server" id="IndexValReq" ControlToValidate="EditIndexVal" ErrorMessage="*" />
                                                      </EditItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:BoundColumn DataField="Editable" Visible="False" HeaderText="Editable" />
                                                <asp:BoundColumn DataField="IndexRequired" Visible="False" HeaderText="IndexRequired" />
                                                <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                                          </Columns>
                                    </asp:datagrid>

Please help me john
I''ll really appreciate your help
Thanks
Nirja

0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11924195
Nirja, you closed off you if() block too early.  The second if() block should be within the first, not outside of it.  It should look like this:

private void dgIndexvalue_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
      if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
      {
            // resolve the label that shows the IndexVal, which looks like it is at column index #3 in the datagrid from your aspx page.
            // "Label2" is the argument because it is the id of the label as defined in the aspx page in the datagrid's template column.
            // It would be better to name this something like "lblIdxVal" and use that in FindControl().
            Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

            // you do not have a databound column for IndexRequired in your aspx datagrid.  add one at the end of the gird and set its
            // visible property to false.  this will become column index #4.  Resolve its value to a string variable as follows:
            string IndexRequired = e.Item.Cells(5).Text;

            // test these two values.
            if (lblIdxVal.Text = "" && IndexRequired == 1)
            {
                 // if the index value is an empty string and the index is required, show each field in bold.
                 e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
                 e.Item.Cells(1).Text = "<b>" + e.Item.Cells(1).Text + "</b>";
                 e.Item.Cells(2).Text = "<b>" + e.Item.Cells(2).Text + "</b>";
                 lblIdxVal.Font.Bold = true;
            }
      }
}

John
0
 

Author Comment

by:nirjabhim
ID: 11924299
John,
After I add that Method in the code page, Do I need to set somewhere in the pageload, how does it works.
When I compile, It is giving error in some other page.
Please help me resolve this issue
Thanks  lot for your reply and pateince
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11924364
John,
I am getting error in these lines
Please help me resolve .
1.
  Label lblIdxVal = (Label)e.Item.Cells(3).FindControl("lblIdxVal");

c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(583): 'System.Web.UI.WebControls.TableRow.Cells' denotes a 'property' where a 'method' was expected
and
2.
string IndexRequired = e.Item.Cells(5).Text;

c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(587): 'System.Web.UI.WebControls.TableRow.Cells' denotes a 'property' where a 'method' was expected

3.if (lblIdxVal.Text = "" && IndexRequired == "1")
c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(591): Operator '&&' cannot be applied to operands of type 'string' and 'bool'

4.e.Item.Cells(0).Text = "<b>" + e.Item.Cells(0).Text + "</b>";
c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(594): 'System.Web.UI.WebControls.TableRow.Cells' denotes a 'property' where a 'method' was expected
same for other 2 lines of bold tags lines

Thanks a lot for the pateince to help me get to this far.
Please help me resolve this issue.

Thanks
Nirja


0
 

Author Comment

by:nirjabhim
ID: 11924499
John,
Wheather it should be (protected void or private void)
Beacuse I have others Index event Handlers are all protected void.
Please suggest me where I am doing wrong?
See above message for error description.

Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11924683
1, 2, and 4: My mistake again: Cells(x) should be Cells[x] in all instances.

3.  If IndexRequired is a boolean field, then this should be IndexRequired == true rather than IndexRequired == "1".

John

0
 

Author Comment

by:nirjabhim
ID: 11926076
John,
Thanks a lot for your response.
I think the font bold is working but, It making bold everything in that grid,
because I took out the if condition there.
The only thing now is not working is in this line

     if (lblIdxVal.Text = "" && IndexRequired== "1")
If I take out if else "build" is working without errors.

Can you please help me how to add that if condition to that method without errors
I want the Indexval "lblIdxVal" to be null or empty and also the other feild in DB Indexrequired = 1 then the records should display bold
FYI- IndexRequired field in DB is Datatype "Bit", That is the reason I want the values 1 or 0
In SP I added that "IndexRequired" column in select statement and also to Data grid asp bound cloumn
<Columns>
                                                <asp:BoundColumn DataField="IndexValueID" ReadOnly="True" Visible="False" HeaderText="Index Value ID" />
                                                <asp:BoundColumn DataField="IndexType" ReadOnly="True" Visible="False" HeaderText="Index Type" />
                                                <asp:BoundColumn DataField="IndexName" ReadOnly="True" HeaderText="Name"></asp:BoundColumn>
                                                <asp:TemplateColumn HeaderText="Value">
                                                      <ItemTemplate>
                                                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>' ID="lblIdxVal"/>
                                                      </ItemTemplate>
                                                      <FooterTemplate>
                                                            <asp:Button Text="Add" CommandName="Insert" Runat="server" ID="Button1"></asp:Button>
                                                      </FooterTemplate>
                                                      <EditItemTemplate>
                                                            <asp:TextBox runat="server" ID="EditIndexVal" Text='<%# DataBinder.Eval(Container, "DataItem.IndexVal") %>'/>
                                                            <asp:RegularExpressionValidator id="IndexValRegEx" runat="server" ControlToValidate="EditIndexVal" ValidationExpression=".*"
                                                                  ErrorMessage="Your entry is not valid." display="dynamic" />
                                                            <asp:RequiredFieldValidator runat="server" id="IndexValReq" ControlToValidate="EditIndexVal" ErrorMessage="*" />
                                                      </EditItemTemplate>
                                                </asp:TemplateColumn>
                                                <asp:BoundColumn DataField="Editable" Visible="False" HeaderText="Editable" />
                                                <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                                                <asp:BoundColumn DataField="IndexRequired" Visible="False" HeaderText="IndexRequired" />
                                          </Columns>

Please help me john,
I think if "if condition" works, I am good to go.
Thanks a lot for your pateince from yesterday.

Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11926147
Nirja:

Since the IndexRequired field is a bit, in the datatable it will be a boolean, thus you should resolve what is in that column to a boolean variable:
This is what you have right now:

string IndexRequired = e.Item.Cells(5).Text;

It should be:

bool IndexRequired = (bool)e.Item.Cells(5).Text;

And then your condition should be:

if (lblIdxVal.Text = "" && IndexRequired== false)

John
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11926152
Oops:

The conditions should test for IndexRequired == true, not false:

if (lblIdxVal.Text = "" && IndexRequired== true)

John
0
 

Author Comment

by:nirjabhim
ID: 11926276
John,
thanks lot for your response
This is the error in this line now
if (lblIdxVal.Text = "" && IndexRequired== true)

c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(593): Operator '&&' cannot be applied to operands of type 'string' and 'bool'

Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11927077
Oh yes... I am just missing all the little things...

if (lblIdxVal.Text = "" && IndexRequired== true)

should be

if (lblIdxVal.Text == "" && IndexRequired== true)

Sorry about that.

John

0
 

Author Comment

by:nirjabhim
ID: 11927178
John,
The error now is in this line

bool IndexRequired = (bool)e.Item.Cells(5).Text;
Error description is
c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(588): Cannot convert type 'string' to 'bool'

thanks for your pateince
nirja
0
 

Author Comment

by:nirjabhim
ID: 11927185
John,
The error now is in this line

bool IndexRequired = (bool)e.Item.Cells[5].Text;
Error description is
c:\inetpub\wwwroot\NotreDame\DocMaint.aspx.cs(588): Cannot convert type 'string' to 'bool'

thanks for your pateince
nirja
0
 

Author Comment

by:nirjabhim
ID: 11927247
John,
I changed the line to like this
bool IndexRequired = Convert.ToBoolean(e.Item.Cells[4].Text);
Looks like it worked
I'll do more testing and let you know, If I need anything
Thanks Lot for your pateince and help
Thanks
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11927835
John,
The records in datgrid are displaying bold for lblIdxVal.Text == ""  no matter the IndexReuired in 0 or 1
I want to display only Indexrequired==1 and indexvalue is empty
Any ideas on why I am getting those records bold even for Indexrequired =0
Thanks
nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11927903
Put a break point on the if statement and make sure both are evaluating to true.

John
0
 

Author Comment

by:nirjabhim
ID: 11928181
John,
Thanks for your pateince
I debugged code. Even for the records which IndexRequired = 0 showing when I hover over the requiredIndex in the if statement, it is shlowing IndexRequired=true
What do you recomend to do the next step to change something in aspx page or suggest me with any resolution

Thanks
nirja
0
 

Author Comment

by:nirjabhim
ID: 11928246
John,
Now I resolved that error but when i click on edit button for Edit template, I am getting error below

Server Error in '/' Application.
--------------------------------------------------------------------------------

String was not recognized as a valid Boolean.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid Boolean.

Source Error:


Line 579:                  {
Line 580:                        Label lblIdxVal = (Label)e.Item.Cells[5].FindControl("lblIdxVal");
Line 581:                        bool IndexRequired = Convert.ToBoolean(e.Item.Cells[3].Text);
Line 582:                        //int IndexRequired = Convert.ToUInt16(e.Item.Cells[4].Text);
Line 583:
 

Source File: c:\inetpub\wwwroot\notredame\docmaint.aspx.cs    Line: 581

Stack Trace:


[FormatException: String was not recognized as a valid Boolean.]
   System.Boolean.Parse(String value) +269
   System.Convert.ToBoolean(String value) +12
   NotreDame.DocMaint.dgIndexvalue_ItemDataBound(Object sender, DataGridItemEventArgs e) in c:\inetpub\wwwroot\notredame\docmaint.aspx.cs:581
   System.Web.UI.WebControls.DataGridItemEventHandler.Invoke(Object sender, DataGridItemEventArgs e) +0
   System.Web.UI.WebControls.DataGrid.OnItemDataBound(DataGridItemEventArgs e)
   System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource)
   System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
   System.Web.UI.WebControls.BaseDataList.DataBind()
   NotreDame.DocMaint.dgIndexValue_EditCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\notredame\docmaint.aspx.cs:418
   System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs e)
   System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain() +1292

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.985; ASP.NET Version:1.1.4322.968
0
 

Author Comment

by:nirjabhim
ID: 11928365
John,
The convertion of boolean statement for the Indexrequired value is causing error when I click on the Edit button.
See above message for details on error
Please help me resolve this issue
Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11928474
This is probably because the item is showing the EditItemTemplate rather than the ItemTemplate.  In this line of code:

if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)

add the following:

&& e.Item.ItemIndex != dgIndexValue.EditItemIndex

so that the full line reads:

if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer && e.Item.ItemIndex != dgIndexValue.EditItemIndex)

John


0
 

Author Comment

by:nirjabhim
ID: 11928507
JOHN,
Thanks alot for your response.
Now for not bold values when I click on edit button no error. But When I click on Edit button for Bold records, I am getting following error.
Should I need to add anything else to the statement.

Server Error in '/NotreDame' Application.
--------------------------------------------------------------------------------

Can't convert <b>String</b> to EasyAccess.Framework.IndexType
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Can't convert <b>String</b> to EasyAccess.Framework.IndexType

Source Error:



Thanks
Nirja


Line 186:                        if ( fi.Name == Value )
Line 187:                              return fi.GetValue( null );// We use null because enumeration values are static
Line 188:                  throw new Exception( string.Format("Can't convert {0} to {1}", Value, t.ToString()) );
Line 189:            }
Line 190:
 

Source File: C:\Visual Studio Projects\CSI FRAMEWORK Phase 2\CommonMethods.cs    Line: 188

Stack Trace:


[Exception: Can't convert <b>String</b> to EasyAccess.Framework.IndexType]
   CSIFramework.CommonMethods.StringToEnum(Type t, String Value) in C:\Visual Studio Projects\CSI FRAMEWORK Phase 2\CommonMethods.cs:188
   NotreDame.DocMaint.dgIndexValue_ItemCreated(Object sender, DataGridItemEventArgs e) in c:\inetpub\wwwroot\notredame\docmaint.aspx.cs:489
   System.Web.UI.WebControls.DataGrid.OnItemCreated(DataGridItemEventArgs e)
   System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource)
   System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
   System.Web.UI.WebControls.BaseDataList.DataBind()
   NotreDame.DocMaint.dgIndexValue_EditCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\notredame\docmaint.aspx.cs:418
   System.Web.UI.WebControls.DataGrid.OnEditCommand(DataGridCommandEventArgs e)
   System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain() +1292

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.985; ASP.NET Version:1.1.4322.968
0
 

Author Comment

by:nirjabhim
ID: 11928605
John,
Should i add anything elase to if statement because, For the Bold records in the Datagrid when i click on the Edit button, I am getting the above error.
i am not getting error for not bold records, I can edit the values for not bold records

Please help me john
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11928640
John,
It is causing error in this method when I click on edit for the bold record
Line: dgIndexValue.DataBind();
protected void dgIndexValue_EditCommand(object source, DataGridCommandEventArgs e)
            {
                  SecurityAccess sa = new SecurityAccess();

                  if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Write", "", ""))
                  {
                        strIndexValueIndexType = e.Item.Cells[1].Text;
                        dgIndexValue.EditItemIndex = e.Item.ItemIndex;
                        dgIndexValue.DataSource = CreateIndexValueDataSource();
                        dgIndexValue.DataBind();
                  }
            }
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11928651
There's obviously a lot more going on here....  It looks like you have a library of functions, and an enum called IndexType.  Based on the error, it looks like you have an index type specified in your data as "String", but when you try to try to convert "<b>String</b>" to the corresponding enum, it bombs because there is no member of the IndexType enum called "<b>String</b>".

If you are unfamiliar with enums, they are like variables.  You will remember we were having a problem with "ItemType.Header" and "ItemType.Footer" (it was "ListItemType").  ListItemType is an enum with members like "Header" "Footer", "AlternatingItem", etc.  Your framework has a common function called StringToEnum() which seems to convert a string to the corresponding enum member, which in your case is probably EasyAccess.Framework.IndexType.String.  The problem is caused because we added the <b> and </b> tags to make the index type show as boolfaced.

Here is what we need to do with this:

Replace the standard bound column for IndexType (it looks like it is at column index #1) with a TemplateColumn and add an ItemTemplate.  In that ItemTemplate, add a Label control and name it "lblIndexType".  Then instead of this code in your OnItemDataBound event:

e.Item.Cells[1].Text = "<b>" + e.Item.Cells[1].Text + "</b>";

put in its place.

((Label)e.Item.Cells[1].FindControl("lblIndexValue")).Font.Bold = true;

just like we did with the index value label.

John
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11928661
Also, when you add the label control to the ItemTemplate, make sure to bind it to the proper column in your datatable.

John
0
 
LVL 10

Accepted Solution

by:
jnhorst earned 2000 total points
ID: 11928677
Just saw your recent post:  Here is a correction from my recent post:

I told you to add a Label and name it "lblIndexType", but then in the FindControl() call I told you to change I put "lblINdexValue".  Obviously you want to put the same thing in the FindControl() method that you named the Label, so in your ItemDataBound event, make sure "lblIndexType" is both the name of the label and in the argument in FindControl().

For your EditItem command, you will need to make the same basic change:

if ( sa.AllowedAccess( Convert.ToInt32( this.User.Identity.Name), "DocMaint", "Write", "", ""))
               {
                    // change this line: strIndexValueIndexType = e.Item.Cells[1].Text; // to what I have below.
                    dgIndexValue.EditItemIndex = e.Item.ItemIndex;
                    dgIndexValue.DataSource = CreateIndexValueDataSource();
                    dgIndexValue.DataBind();
               }

strIndexValueIndexType = ((Label)e.Item.Cells[1].FindControl("lblIndexType")).Text;

This should solve this latest issue.

John
0
 

Author Comment

by:nirjabhim
ID: 11928727
John If I replace as an item Template instaead of asp bound column the cloumn is diaplying in the internet explorer.
Please suggest what to do with this
Item template
<asp:TemplateColumn HeaderText="Value">
                                                      <ItemTemplate>
                                                            <asp:Label  ReadOnly="True" Visible="False" HeaderText="Index Value ID" ID="lblIndexType"/>
                                                      </ItemTemplate>
                                                </asp:TemplateColumn>

Thanks
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11928745
OK, let's back up here.  I looked back and you have the Visible property set to false on this column, so you do not want it to appear in the browser, which obviously means that there is no need to change the text to boldfaced.  This means you do not need to change it from bound column to template column.  Go ahead and change it back.  Then after you change it back, go into your ItemDataBound event and take out the line that adds the <b> and </b> to the Text property of column #1 (just remove that line of code altogether).  Also change the Edit command routine back to simply get the IndexType from e.Item.Cells[1].Text.

John
0
 

Author Comment

by:nirjabhim
ID: 11928753
Okay i achanged to earier version of code for Indexrtype
and let me test more and let you know.
Thanks alot for your pateince.......
I think I am confusing you with all questions.Otherwise, you would have figured out first itself

Thanks
let me test
Nirja
0
 

Author Comment

by:nirjabhim
ID: 11928768
John,
Do you mind, If I close this question and accept this question tomorrow, I want to do lot of testing tomorrow.
If I have to post 1 more question. Nobody will understand except you and me,
Please bear with me
It is 1:35AM for me, I'll do more testing tommorrow and accept

Thanks alot for your pateince and help
Nirja
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11928774
If you want to accept the answer and then test and then post a new question on the matter after testing that will be fine.  I check the ASP.NET board daily and I'll see any followup questions you might have in a few days.

John
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question