jeudi 16 avril 2015

How to stop gridview creating a div in asp.net

I've got the following asp.net code that generates a listitem dynamically and populates it with a panel that contains a gridview:



Panel panBlocks = new Panel();
panBlocks.ID = "PanBlockQuestionID" + recordcount.ToString();
panBlocks.Width = 1300;
panBlocks.Height = 100;
panBlocks.BackColor = System.Drawing.ColorTranslator.FromHtml("#fabb3d");

GridView gvEmployee = new GridView();
gvEmployee.ID = "gvEmployees" + recordcount.ToString();
gvEmployee.AutoGenerateColumns = true;
gvEmployee.DataSource = dtBlocks;
gvEmployee.DataBind();
gvEmployee.Style.Add("position", "relative");
panBlocks.Controls.Add(gvEmployee);


It generates the gridview but wraps it in a div. How do I stop it generating the div as it messes up the styling. The html it generates is:



<li id="CPH_Body_liQuestions3" class="liQuestions" style="height:40px;" myCustomIDAtribute="3"><a></a><input type="image" name="ctl00$CPH_Body$lblImg3" id="CPH_Body_lblImg3" class="liQuestionsLabel2" src="../../Images/gtk_cancel.png" style="width:30px;" /><input type="image" name="ctl00$CPH_Body$lblImg3" id="CPH_Body_lblImg3" class="liQuestionsLabel2" src="../../Images/phone_book_edit.png" style="width:30px;" /><span id="CPH_Body_lblID3" class="liQuestionsLabel" style="display:inline-block;width:35px;">298,</span><span id="CPH_Body_lblQuestionType3" class="liQuestionsLabel" style="display:inline-block;width:25px;">1, </span><span id="CPH_Body_lblMsgPrompt3" class="liQuestionsLabel" style="display:inline-block;width:300px;">Fit nylon spacer BG502 to tray,</span><span id="CPH_Body_lblExpectedResp3" class="liQuestionsLabel" style="display:inline-block;width:100px;">YES,</span><span id="CPH_Body_lblImg3" class="liQuestionsLabel" style="display:inline-block;width:30px;"> img: </span><span id="CPH_Body_lblFailMsg3" class="liQuestionsLabel" style="display:inline-block;width:300px;">Not fitted,</span><span id="CPH_Body_lblRetryMsg3" class="liQuestionsLabel" style="display:inline-block;width:300px;">Retry,</span><span id="CPH_Body_lblStart3" class="liQuestionsLabel" style="display:inline-block;width:10px;">,</span><span id="CPH_Body_lblEnd3" class="liQuestionsLabel" style="display:inline-block;width:10px;">,</span><img id="CPH_Body_lblImg3" class="liQuestionsLabel2" onclick="showPanel(&#39;CPH_Body_liQuestions3&#39;)" src="../../Images/block3.png" style="width:30px;" /><div id="CPH_Body_PanBlockQuestionID3" style="background-color:#FABB3D;height:100px;width:1300px;">
<div>
<table cellspacing="0" rules="all" border="1" id="gvEmployees3" style="border-collapse:collapse;position:relative;">
<tr>
<th scope="col">B1ID</th><th scope="col">B1IncEx</th><th scope="col">B1Criteria</th>
</tr><tr>
<td>3</td><td>EX</td><td>590P</td>
</tr>
</table>
</div>
</div></li>


How do I stop the div being generates please as I can't apply styling to it.


Many Thanks


Aucun commentaire:

Enregistrer un commentaire