ASP.NET - avoid Alternate row style color for hiddenfield in Dynamic Table  ASP.NET - avoid Alternate row style color for hiddenfield in Dynamic Table

Asked By deepi singh
26-Oct-10 09:41 AM

  hi gyus,

This is my code.iam providing alternate coloring for my columns in dynamic table.In this i want to avoid Alternate row style color for hiddenfield

Try

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dim itemCount As Integer

 

tblRow(itemCount) =

 

 

For itemCount = 0 To Icount - 1New TableRowIf (itemCount Mod 2 = 1) Then

tblRow(itemCount).BackColor = Drawing.Color.LightBlue

 

 

End If

 

 

'----this is for Qty * textbox---------

tblCol(1) =

txtQty(itemCount) =

txtQty(itemCount).ID =

txtQty(itemCount).Width =

 

New TableCellNew TextBox"txtQty" & itemCount"40"

txtQty(itemCount).Text =

 

"0"

txtQty(itemCount).Attributes.Add(

 

tblCol(1).Controls.Add(txtQty(itemCount))

tblRow(itemCount).Cells.Add(tblCol(1))

tblOrderLineItem.Rows.Add(tblRow(itemCount))

 

 

"onBlur", "quantity_change(" & itemCount & ")")' AddHandler txtQty(itemCount).TextChanged, AddressOf getQty

 

 

'------this is for Item# *textbox------

tblCol(2) =

txtItem(itemCount) =

txtItem(itemCount).ID =

txtItem(itemCount).Width =

 

New TableCellNew TextBox"txtItem" & itemCount"90"

txtItem(itemCount).AutoPostBack() =

 

True

tblCol(2).Controls.Add(txtItem(itemCount))

 

tblRow(itemCount).Cells.Add(tblCol(2))

tblOrderLineItem.Rows.Add(tblRow(itemCount))

 

 

 

AddHandler txtItem(itemCount).TextChanged, AddressOf getItem'------this is for Item Description label----------

tblCol(3) =

lblItemDesc(itemCount) =

lblItemDesc(itemCount).ID =

lblItemDesc(itemCount).Width =

 

New TableCellNew Label"lblItemDesc" & itemCount"160"

lblItemDesc(itemCount).Style.Add(

lblItemDesc(itemCount).Font.Size =

 

"text-align", "left")"8"

 

tblCol(3).Controls.Add(lblItemDesc(itemCount))

tblRow(itemCount).Cells.Add(tblCol(3))

tblOrderLineItem.Rows.Add(tblRow(itemCount))

 

 

'------this is for Availability label----------

tblCol(4) =

lblAvailability(itemCount) =

lblAvailability(itemCount).ID =

lblAvailability(itemCount).Width =

 

New TableCellNew Label"lblAvailability" & itemCount"120"

lblAvailability(itemCount).Style.Add(

 

lblAvailability(itemCount).Font.Size =

 

"text-align", "left")"8"

  Vasanthakumar D replied to deepi singh
26-Oct-10 10:52 AM
Hi,

your question is not clear... what is your requirement?

Regards,
Vasanth
  sri sri replied to deepi singh
26-Oct-10 11:48 AM
hi,

To display the gridview with alternative rows back color, try the below code

<asp:GridView ID="GridView1" AlternatingRowStyle-BackColor="yellow" RowStyle-BackColor="blue" runat="server">
----
----
----
----
</asp:GridView>

you can also use css class , try the below code

<asp:GridView ID="GridView1"  AlternatingRowStyle-CssClass="row1" RowStyle-CssClass="row2" runat="server">

----
----
----
----
</asp:GridView>
  deepi singh replied to Vasanthakumar D
26-Oct-10 11:55 AM

This is my code.iam providing alternate row style color in dynamic table.In this i want to avoid Alternate row style color for hiddenfield

  

 

Dim itemCount As Integer

  

 

For itemCount = 0 To Icount - 1New TableRow

If (itemCount Mod 2 = 1) Then

tblRow(itemCount).BackColor = Drawing.Color.LightBlue-----------------------------------applying alternating colors for rows in dynamic table.

End If

  

 

'----this is for Qty * textbox---------

tblCol(1) = New TableCell

txtQty(itemCount) = New  TextBox

txtQty(itemCount).ID = "txtQty" & itemCount

txtQty(itemCount).Width = "40"

txtQty(itemCount).Text = "0"

tblCol(1).Controls.Add(txtQty(itemCount))

tblRow(itemCount).Cells.Add(tblCol(1))

tblOrderLineItem.Rows.Add(tblRow(itemCount))

 

tblCol(2) = New TableCell
 hdnSdate(itemCount) =New HiddenField
 hdnSdate(itemCount).ID = "hdnSdateID" & itemCount
 tblCol(2).Controls.Add(hdnSdate(itemCount))
 tblRow(itemCount).Cells.Add(tblCol(2))
 tblOrderLineItem.Rows.Add(tblRow(itemCount))

next

when iam applying row style color for dynamic table....iam getting color to hiddenfield row also how to avoid color for hiddenfields?

tblRow(itemCount).BackColor = Drawing.Color.LightBlue------this code applying alternate color to whole table
row .......but i dont to apply for hiddenfield?


  deepi singh replied to sri sri
26-Oct-10 11:57 AM

This is my code.iam providing alternate row style color in dynamic table.In this i want to avoid Alternate row style color for hiddenfield

  

 

Dim itemCount As Integer

  

 

For itemCount = 0 To Icount - 1New TableRow

If (itemCount Mod 2 = 1) Then

tblRow(itemCount).BackColor = Drawing.Color.LightBlue-----------------------------------applying alternating colors for rows in dynamic table.

End If

  

 

'----this is for Qty * textbox---------

tblCol(1) = New TableCell

txtQty(itemCount) = New  TextBox

txtQty(itemCount).ID = "txtQty" & itemCount

txtQty(itemCount).Width = "40"

txtQty(itemCount).Text = "0"

tblCol(1).Controls.Add(txtQty(itemCount))

tblRow(itemCount).Cells.Add(tblCol(1))

tblOrderLineItem.Rows.Add(tblRow(itemCount))

 

tblCol(2) = New TableCell
 hdnSdate(itemCount) =New HiddenField
 hdnSdate(itemCount).ID = "hdnSdateID" & itemCount
 tblCol(2).Controls.Add(hdnSdate(itemCount))
 tblRow(itemCount).Cells.Add(tblCol(2))
 tblOrderLineItem.Rows.Add(tblRow(itemCount))

next

when iam applying row style color for dynamic table....iam getting color to hiddenfield row also how to avoid color for hiddenfields?

tblRow(itemCount).BackColor = Drawing.Color.LightBlue------this code applying alternate color to whole table
row .......but i dont to apply for hiddenfield?

  Vasanthakumar D replied to deepi singh
26-Oct-10 12:10 PM
Hi,

first thing, if the cell is hidden, then color should not be a problem...

but still you dont want to assign color to hidden cells, you can do the below things


      For Each tc As TableCell In tblRow(itemCount).Cells
        If tc.Visible = True Then
          tc.BackColor = Drawing.Color.LightBlue
        End If
      Next

Regards,
Vasanth
  deepi singh replied to Vasanthakumar D
26-Oct-10 12:20 PM
hi,

I will try this code tomm and get you back...Thanks for ur rly and time too
Create New Account
help
HeaderStyle HorizontalAlign = " Left" VerticalAlign = " Middle" Width = " 40px" > < / HeaderStyle > < ItemStyle HorizontalAlign = " Justify" VerticalAlign = " Middle" / > < ItemTemplate > < asp:TextBox ID = " txtCountry" runat = " server" > < / asp:TextBox > < ajaxToolkit:AutoCompleteExtender runat = " server" ID = " autoComplete1" TargetControlID = " txtCountry" ServicePath = " AutoComplete.asmx" ServiceMethod = " GetCountriesList" MinimumPrefixLength = " 1 is selected, the ace_itemSelected() JavaScript method executes. The ace_ItemSelected() method updates the value of the HiddenField with the value of the selected suggestion. The JavaScript method looks like below :- function ace_itemSelected Open(); return cmd.ExecuteReader( CommandBehavior .CloseConnection); } catch ( Exception ex) { throw ex; } } After selecting value from textbox, output look like below :- Cust protected void Button1_Click( object sender, EventArgs e) { string value = RadioButtonList1 da = new SqlDataAdapter (q, conn); DataSet ds = new DataSet (); da.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } Dynamic Search using Stored procedure Hi It is best practise to separate Data access layer from lot more advantages in doing so. In order to implement a search engine where a ASP.NET form consists of various control to take user input, when you want to process your
to insert binary data into a database Question: The code listed a cut from an asp.net VB code behind page. I am able to insert word, excel and pdf MIMEtypes to a table in a sql server 2008 database. I am also now able to retrieve and display final problem I have is the need to add an id value to the same table. The actual id field is named rid in the table. In this line, cmd.Parameters.Add("@rid", SqlDbType.Int).Value = xxxxx, if I replace the is not going to be a hardcoded value but instead is going to be a dynamic value. Instead it is a hidded field with the value being assigned that is derived of things but mostly what I get is (Failed to convert parameter value from a HiddenField to a String.). Please don't make the assumption that I know code syntax because Value = bytes InsertUpdateData(cmd) Imports System.Data Imports System.Data.SqlClient Imports System.IO Partial Class Addreqdocs Inherits System.Web.UI. Page Protected Sub Page_Load( ByVal sender As Object , ByVal e
can be cached so that for same request no nedd to go to server. 5. HiddenField- To store page level infomation, like any value. Hope this will help you. So many part is the extra string in the product.aspx url that is the queryString 4. HiddenField : It is somewhat like the queryString, in queryString we can see the value in the can determine which object provides the best solution for persisting data between requests in an ASP.NET application. Figure 1 lists the different state management objects and describes when they should be used. In ASP.NET, four new objects have been added: Cache, Context, ViewState, and the Web.Config file. Classic ASP objects that are also available in ASP.NET include Application, Cookie, Form Post with a hidden form field, QueryString, and Session. Note that
ASP Net works on IIS5 but not in IIS6 using IE I just setup a new server std ed. It is running .net framework 1.1 with sp1. I have a simple asp.net page. When I depress a submit button nothing happens. Here's the funny part. If work for this app, chances are you got some baaaad code in there in the ASP.NET page. This page is currently working under win 2000 IIS 5. I migrated the website div id = "pageHeader" runat = "server"> < / div> <br> <br> <form id = "Form1" method = "post" runat = "server"> <table cellSpacing = "0" cellPadding = "6" align = "center" border = "0"> <tr> <td> <asp:label id = "lblCompany" style Z-INDEX: 102" runat = "server" Height = "24px" Width = "80px"> Company:< / asp:label> < / td> <td> <asp:textbox id = "txtCompany" style = "Z-INDEX: 101" runat = "server" Width = "288px" tabIndex = "1" MaxLength = "40"> < / asp
How to sum and display total in a label using javascript ASP.NET I am having a grid view as follows I have written a javascript to display Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); } I will not get the Amount in that textbox until and unless user selects a value from dropdown and enters the quantity in the textbox available. The Amount will get displayed when User enters quantity and onblur event I will Label lblamount = (Label)e.Row.FindControl("lblTotal"); lblamount.Text = total.ToString(); } } Regards, give the quantity textboxes a name like "quantity", then you can get them with: document . getElementsByName ( "quantity" ); give your use the body onload event to append eventlisteners to the onblur event of your quantity textboxes. And while you're at it, use a namespace, a singleton, so you don't body onload = " p . onload () " > < / body> you might want to do some validation on the quantity textboxes, but I leave that up to you. or Run a loop to get those td label' ). innerHTML = "TOTAL:" + sum ; Hello, Take Gridview templatefield as following way < asp:TemplateField > < ItemTemplate > < asp:TextBox ID = "txtQuantity" onchange = "Total()" runat = "server" > < / asp:TextBox > < / ItemTemplate > < / asp:TemplateField > < asp:TemplateField > < ItemTemplate > < asp