Data grid in content page [Resolved]

Posted by Sankettt under ASP.NET on 10/10/2011 | Points: 10 | Views : 1194 | Status : [Member] | Replies : 3
I want to add a datagrid on the content page.
but it is showing datagrid should be placed inside the form tag with runat=server .!
but a content page doesnt have this tag in it?
so how do i add it ?

sankettt


Responses

Posted by: Ndebata on: 10/10/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
You have to add to the content tag created by the content placeholder in the master page under form tag.
Master Page
<head runat="server">

<title></title>
<asp:ContentPlaceHolder ID="HeaderContentPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</head>
<body >
<form id="form1" runat="server">
<asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>

Content Page
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
Add Your Gridview here

</asp:Content>

Else post your markup for both master and content page.

Sankettt, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 10/11/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

If you are set the master pge for the content page, You can add datagrid control without form tag in the content page. Because this content page works as the child of the master page so we didn't add form tag in the content page.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sankettt, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sankettt on: 10/11/2011 [Member] Starter | Points: 25

Up
0
Down
thanks i got it..:)
it was really helpful.!

sankettt

Sankettt, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response