Wednesday, 15 December 2010

How to work with fieldset and legend html tags?

 This is the sample for working with <fieldset> and <legend> html tags.


<fieldset style="text-align: left; width: 49%;"align="left">      <legend style="text-align: left; font-weight: 700;">
<img style="width: 50px; border-width: 0px;" src="../Images/interview_icon.jpg" id="ctl00_CPH_Image2">
&nbsp;
<span style="display: inline-block; color: White; background-color: Blue; border-color: White; border-style: double; font-size: 10pt;" class="Label_name" id="ctl00_CPH_Label334">Action</span>
&nbsp;&nbsp;&nbsp; 
</legend>
<table align="center">
<tbody>
<tr>
<td style="text-align: right;" class="style2">&nbsp;</td>
<td style="text-align: left;" class="style4">&nbsp;</td>
<td style="text-align: left;">&nbsp;</td>
</tr>
<tr> 
<td style="text-align: right;" class="style2">
<span class="Label_name" id="ctl00_CPH_Label332">Hiring Process  :</span>
</td>
<td style="text-align: left;" class="style4">
<select style="width: 250px;" id="ctl00_CPH_DDL_Hiring" onchange="javascript:setTimeout('__doPostBack(\'ctl00$CPH$DDL_Hiring\',\'\')', 0)" name="ctl00$CPH$DDL_Hiring">
            <option value="0">Select</option>
            <option value="1">Hiring Key</option>
            <option value="2">Line Partner Key</option>
            <option value="3">Line Payroll Key</option>
        </select>
</td>
<td style="text-align: left;">
<input type="submit" style="color: Blue;" class="Button_Normal" id="ctl00_CPH_btnProcess" value="Process" name="ctl00$CPH$btnProcess">
</td>
</tr>
</tbody></table>
</fieldset>

What is the difference between <%# Eval("Name") %> and <%# DataBinder.Eval(Container.DataItem,"Name") %>

What is the difference between <%# Eval("Name") %> and <%# DataBinder.Eval(Container.DataItem,"Name") %> in your aspx page?

::: Eval("Name") is a simplified form of the DataBinder.Eval(Container.DataItem, "Name") syntax.
It only works inside of data-bound template controls.

what is difference between functions and methods?

You can know what is difference between functions and methods from the following link.
http://www.eggheadcafe.com/community/aspnet/2/10046933/what-is-difference-between-functions-and-methods.aspx

What is "View State" ?

This is just detail explanation about the view state element of the asp.net frame work.
http://www.dotnetspider.com/resources/609-ViewState-ASP-NET.aspx

Tuesday, 14 December 2010

Getting data and datakeys inside the Grid View

::: Getting run time control  of the grid view inside the RowDataBound method.
Private Sub  GridView1_RowDataBound(ByVal sender As Object,  
ByVal e As  System.Web.UI.WebControls.GridViewRowEventArgs) 
Handles  GridView1.RowDataBound

If CType(e.Row.FindControl("LblLanguagesCode"), Label).Text = "" Then
e.Row.Cells(2).Text = ""
End If

End Sub

::: Getting datakeynames of the grid view inside the RowDataBound method.
 Private Sub  Grid_Work_Experience_RowDataBound(ByVal sender As Object,  
ByVal e As  System.Web.UI.WebControls.GridViewRowEventArgs)  
Handles  Grid_Work_Experience.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
   Dim Employer As String = Grid_Work_Experience.DataKeys(e.Row.RowIndex).Values("Employer") & ""
   Dim Position As String = Grid_Work_Experience.DataKeys(e.Row.RowIndex).Values("Position") & ""
   If Employer <> "" Then
     e.Row.Cells(3).Text = Employer
   End If
   If Position <> "" Then
      e.Row.Cells(3).Text = Employer & " / " & Position
   End If
End If
End Sub
::: Finding the control of selected row inside the RowUpdating method

Private Sub  GridView1_RowUpdating(ByVal sender As Object,  
ByVal e As  System.Web.UI.WebControls.GridViewUpdateEventArgs)Handles  GridView1.RowUpdating
Dim Continent_Name As String = CType(Me.GridView1.Rows(e.RowIndex).FindControl("TxtContinentNameEdit"), TextBox).Text
If Continent_Name = "" Then
CType(Me.AlertMessageBox1.FindControl("lblMessage"), Label).Text = "Please input Continent Name field !!!"
Me.Mpe_AlertMessage.Show()
Me.ShowContinentData()
CType(Me.DtgContinent.Rows(e.RowIndex).FindControl("TxtContinentNameEdit"), TextBox).Text = Continent_Name
End If
End Sub

::: Finding the control of gridview inside the normal method
Protected Sub ImgSaveAddNew_Click(ByVal sender As Object,  
ByVal e As System.Web.UI.ImageClickEventArgs)
Dim Languages_Name As String = CType(Me.GridView1.FooterRow.FindControl("TxtLanguagesNameAddNew"), TextBox).Text
End Sub