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.
Why do I get error message ‘NewPageIndex is not a member of ‘System.EventArgs’.’
You probably declared the event handler for OnPageIndexChanged event incorrectly. Make sure that the event handler looks like the following. <asp:DataGrid id='DataGrid1' runat='server'... OnPageIndexChanged='<EventName>'.../> VB.NET protected Sub <Eventname>(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) ’... end sub C# protected void <EventName>(object sender , System.Web.UI.WebControls.DataGridPageChangedEventArgs) { //... }