set ToolTip for dropdownlist inside gridview from query from database asp.net C# -
I am writing the asp.net project in c # and I have a small problem.
I have a dropdown list inside a gridview and both of them are initially filled with a database, but different tables (different selection queries).
I want to set ToolTip to be the query for the list given below which is used to fill the gridview (datatelay 1) with the following code:
& Lt; Asp: TemplateField HeaderText = "select supervisor" item style-width = "100px" & gt; & Lt; ItemTemplate & gt; & Lt; ASP dropdown list id = "dropdown list 1" Rnat = "server" Otopostbak = "true" on-selected index Chenjed = "DdlTest_SelectedIndexChanged" tooltip = & lt;% # ((DataSet1.DataTable1Row) (((DataRowView) container .dataitum) .ro)) .p_id% & gt; & Gt; & Lt; / ASP: DropDownList & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt;
But when I try to run the project, I get the following error:
The object reference is not set to an instance of an object < / Code>
If I try to set the tooltip manually, example:
ToolTip = "abc"
Without any problems
Does anyone have to set tooltips for a dropdown list from the database query? Thank you.
I will GridView event each GridViewRow
but only when < Code> GridView becomes databound.
Protected Zero GridView1_RowDataBound (Object Sender, GridViewRowEventArgs e) {Var Grid = (GridView) Sender; If (E.Rao Silver == Data Controller Type. DATA) {dropdown list dropdown list 1 = (dropdown list) e. Cry. Fund Control ("Dropdown List 1"); Detourovevv = (Detourviewview) E.R.D. Dataset DS = DRV ROBALDetsetSet; // I'm not 100% sure here that you need to do here, for example: DropDownList1.ToolTip = drv.Row.Field & lt; Int & gt; ("P_id"). ToString (); }}
This is placing more readable and maintain and easier to debug.
Comments
Post a Comment