How to show TextBox web server control with TextMode Property Password as **** rather than blank
For security reason, TextBox with TextMode=’Password’ setting cannot be assigned or populated via the Text property on Page_Load or PostBack event. It’s not recommend for to prefill a ‘Password’ type TextBox with the(‘***’) characters, though below is the solution to achieve this. VB.NET ViewState(‘Pwd’)=TextBox1.Text ; TextBox1.Attributes.Add(‘value’, ViewState(‘Pwd’).ToString ()) ; C# ViewState[‘Pwd’]=TextBox1.Text ; TextBox1.Attributes.Add(‘value’, ViewState[‘Pwd’].ToString ()) ;
Why do I get error message ‘Option Strict On disallows implicit conversions from ‘System.Web.UI.Control’ to ‘System.Web.UI.WebControls.TextBox’.’
For type Casting apply the following steps VB.NET dim aprtxt as string aprtxt= CType(e.Item.FindControl(‘txtapr’), TextBox) C# string aprtxt; aprtxt = (TextBox) e.Item.FindControl[‘txtapr’];
I have set the ItemStyle and the AlternatingItemStyle tags for DataGrid control but they aren’t working correctly , why?
DataGrid generates an HTML Table, with TableRows and Cells. If you already have some display properties set for <td>,<TR>… make sure to check them in the Stylesheet. Whatever properties you set there will normally override whatever you add into your DataGrid’s Item styles.
How to right align cells in the Datagrid when using BoundColumn
Commonly used in conjunction with RTL languages, you can do so as follows: <asp:BoundColumn DataField =’PRoductname’ HeaderText =’ProductName’ ItemStyle-HorizontalAlign=’Right’></asp:BoundColumn>
How can I disable sorting for a specific Column in a DataGrid
Don’t specify the SortExpression for the BoundColumn for which you do not want Sorting. This will only work if you have AutogenerateColumns= false.