I have an ASP.NET Image Control that refuses to render inside of an HTML table.
You will see in the ASPX page that the ASP.NET image control is inside of the HTML table, towards the bottom of the table, below the biography textarea.
When the page populates with data, the image is moved from inside the HTML table, to above the HTML table.
Here's the ASPX page source:
<asp:Panel ID="pnlMembers" runat="server" ClientIDMode="Static">
<table>
<tr>
<td>
Members:
</td>
<td>
<asp:DropDownList ID="ddlMembers" runat="server" ClientIDMode="Static" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlMembers_SelectedIndexChanged">
</asp:DropDownList>
or <asp:Button ID="btnNew" runat="server" ClientIDMode="Static" Text="New Member" OnClick="btnNew_Click" />
</td>
</tr>
<tr>
<td>Name:</td>
<td><asp:TextBox ID="txtName" runat="server" ClientIDMode="Static"></asp:TextBox></td>
</tr>
<tr>
<td>Email:</td>
<td><asp:TextBox ID="txtEmail" runat="server" ClientIDMode="Static"></asp:TextBox></td>
</tr>
<tr>
<td>Password:</td>
<td><asp:TextBox ID="txtPassword" runat="server" ClientIDMode="Static" TextMode="Password"></asp:TextBox></td>
</tr>
<tr>
<td>
Repeat Password:
</td>
<td>
<asp:TextBox ID="txtPassword2" runat="server" ClientIDMode="Static" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>Bio:</td>
<td>
<textarea name="txtBioEditor" id="txtblogEditor" rows="10" cols="80" runat="server"></textarea>
</td>
</tr>
<tr>
<asp:Image ID="imgMember" runat="server" ClientIDMode="Static" />
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnSave" runat="server" ClientIDMode="Static" Text="Save" OnClick="btnSave_Click" />
<asp:Button ID="btnCancel" runat="server" ClientIDMode="Static" Text="Cancel" OnClick="btnCancel_Click" />
</td>
</tr>
</table>
<script>
CKEDITOR.replace("txtBioEditor");
</script>
</asp:Panel>
In the code-behind, I am simply populating the page controls with member data from the DB when the dropdown list selected index is changed.
protected void ddlMembers_SelectedIndexChanged(object sender, EventArgs e)
{
int selectedId = Convert.ToInt32(ddlMembers.SelectedValue);
if (selectedId > 0)
{
Member m = new Member();
m.GetMemberById(selectedId);
if (m.MemberCount > 0)
{
txtName.Text = m.Name;
txtEmail.Text = m.Email;
txtblogEditor.InnerHtml = m.Biography;
imgMember.ImageUrl = m.Image;
}
}
else
{
ClearFields();
}
}
And here is how it renders:
<div id="pnlMembers">
<img id="imgMember" src="/images/member3.jpg"><table>
<tbody><tr>
<td>
Members:
</td>
<td>
<select name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$ddlMembers" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$ddlMembers\',\'\')', 0)" id="ddlMembers">
<option value="0">Select Member</option>
<option value="1">Member 1</option>
<option value="2">Member 2</option>
<option selected="selected" value="3">Member 3</option>
<option value="4">Member 4</option>
</select>
or <input type="submit" name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$btnNew" value="New Member" id="btnNew">
</td>
</tr>
<tr>
<td>Name:</td>
<td><input name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$txtName" type="text" value="Member 3 Name" id="txtName"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$txtEmail" type="text" value="member3#gmail.com" id="txtEmail"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$txtPassword" type="password" id="txtPassword"></td>
</tr>
<tr>
<td>
Repeat Password:
</td>
<td>
<input name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$txtPassword2" type="password" id="txtPassword2">
</td>
</tr>
<tr>
<td>Bio:</td>
<td>
<textarea name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$txtblogEditor" id="txtblogEditor" rows="10" cols="80">Member 3 Bio</textarea>
</td>
</tr>
<tr>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$btnSave" value="Save" id="btnSave">
<input type="submit" name="ctl00$ctl00$ContentPlaceHolder1$ContentAdminMain$btnCancel" value="Cancel" id="btnCancel">
</td>
</tr>
</tbody></table>
<script>
CKEDITOR.replace("txtBioEditor");
</script>
As you can see in the rendered HTML, the image element has been taken out of the table element, and inserted above the table, in the parent div. What is going on here? I appreciate your help.
<tr>
<td>
<asp:Image ID="imgMember" runat="server" ClientIDMode="Static" />
</td>
</tr>
As per my comment re rendering/positioning
Related
i read so many solutions and blogs on this but still not able to get it done.
I have a Repeater in my code, which has labels in ItemTemplate. I need to do a client side validation (using jQuery) on the values entered in the TextBox on a button click event. i have some value in my label which I want to access to make comparision between the values entered in the textbox and text of label. Now I added a custom attribute named datakey to the label and textbox both, so that comparision is easy.
I access the text box and get the datakey attribute.
I get the label with the datakey value same as that of textbox and do my comparision.
Now in Jquery I am not able to access that label.
This is what i wrote in Jquery:
var lbl = $("label").find("[datakey='" + expID + "']");
ASP Code.
<table class="tblDispData">
<asp:Repeater ID="PrjBudgetDetails" runat="server" ClientIDMode="Static">
<HeaderTemplate>
<tr>
<th class="thDataDisp">
<asp:Label ID="LbExpType" runat="server" Text="Expenditure Type" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbAllocatedBudget" runat="server" Text="Allocated Budget" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbAvailedBudget" runat="server" Text="Available Budget" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
<th class="thDataDisp">
<asp:Label ID="LbRequestedBudget" runat="server" Text="Budget Requested" CssClass="LbTblDataDisp"
Font-Bold="true"></asp:Label>
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="tdDataDisp">
<asp:Label ID="ExpTypeText" runat="server" Text='<%#Eval("ExpType") %>' CssClass="LbTblDataDisp"
AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:Label ID="BudgetAllocatedText" runat="server" Text='<%#Eval("BudgetAllocated") %>'
CssClass="LbTblDataDisp" AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:Label ID="BudgetAvailableText" runat="server" dataKey='<%#Eval("ExpID") %>'
Text='<%#Convert.ToDouble(Eval("BudgetAllocated")) - Convert.ToDouble(Eval("BudgetAvailed")) %>'
CssClass="LbTblDataDisp" ClientIDMode="Static" AssociatedControlID="BudgetRequestedText"></asp:Label>
</td>
<td class="tdDataDisp">
<asp:TextBox ID="BudgetRequestedText" runat="server" dataKey='<%#Eval("ExpID") %>'
dataValue='<%#Eval("ExpType") %>' CssClass="tblDataInput"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<td colspan="3">
<span id="Legend1" class="frmInstructions" runat="server">Please enter zero(0) if not
requesting budget for any particular expenditure. The currency is INR. </span>
</td>
<td>
<asp:Button ID="prjBudgetSubmitBtn" runat="server" Text="Submit Budget" CssClass="formNext"
ClientIDMode="Static" OnClick="prjBudgetSubmitBtn_Click" />
</td>
</tr>
</table>
The RESULTING MARKUP HERE
<table class="tblDispData">
<tr>
<th class="thDataDisp">
<span id="LbExpType" class="LbTblDataDisp" style="font-weight:bold;">Expenditure Type</span>
</th>
<th class="thDataDisp">
<span id="LbAllocatedBudget" class="LbTblDataDisp" style="font-weight:bold;">Allocated Budget</span>
</th>
<th class="thDataDisp">
<span id="LbAvailedBudget" class="LbTblDataDisp" style="font-weight:bold;">Available Budget</span>
</th>
<th class="thDataDisp">
<span id="LbRequestedBudget" class="LbTblDataDisp" style="font-weight:bold;">Budget Requested</span>
</th>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Hardware</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP001">7</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl01$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP001" dataValue="Hardware" dataAmount="7" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Software</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP002">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl02$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP002" dataValue="Software" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Software AMC</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP003">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl03$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP003" dataValue="Software AMC" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">Hardware AMC</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP004">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl04$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP004" dataValue="Hardware AMC" dataAmount="9" />
</td>
</tr>
<tr>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="ExpTypeText" class="LbTblDataDisp">UPS</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAllocatedText" class="LbTblDataDisp">9.00</label>
</td>
<td class="tdDataDisp">
<label for="BudgetRequestedText" id="BudgetAvailableText" class="LbTblDataDisp" dataKey="EXP006">9</label>
</td>
<td class="tdDataDisp">
<input name="ctl00$pageMainContent$PrjBudgetDetails$ctl05$BudgetRequestedText" type="text" id="BudgetRequestedText" class="tblDataInput" dataKey="EXP006" dataValue="UPS" dataAmount="9" />
</td>
</tr>
<tr>
<td colspan="3">
<span id="pageMainContent_Legend1" class="frmInstructions">Please enter zero(0) if not
requesting budget for any particular expenditure. The currency is INR. </span>
</td>
<td>
<input type="submit" name="ctl00$pageMainContent$prjBudgetSubmitBtn" value="Submit Budget" id="prjBudgetSubmitBtn" class="formNext" />
</td>
</tr>
</table>
Thanks in advance.
Following code will give you the related label.
$("label[dataKey='" + expID + "']")
Demo
I have one Panel that is linked to a ModelPopupExtenderand there is a button inside the first panel. When I click the first panel's button I want it to execute the event and inside this event I want to pop up the second Panel which is also linked to a ModelPopupExtender, but when I click the first Panel's button the event does not trigger.
Asp Code :
<input type="hidden" runat="server" id="hdnEditBank1" />
<asp:Panel runat="server" ID="pnl1" CssClass="Modal450h450w" Height="300px">
<table id="tblEditBank1" runat="server">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="right" colspan="2"><img runat="server" id="imgExitEdit1" src="../images/Exit_cross.png" /></td>
</tr>
<tr>
<td colspan="3">Name : </td>
<td colspan="2"><telerik:RadTextBox ID="txt1" runat="server" CssClass="largebox"></telerik:RadTextBox></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="4">
<asp:Button runat="server" ID="btnClose" Text="Close" OnClick="btnAdd_Close_Click" />
</td>
<td align="right">
<asp:Button runat="server" ID="btnNext" Text="Next" OnClick="btnEdit_Next_Click" />
</td>
</tr>
</table>
</asp:Panel>
<!-- second panel -->
<asp:ModalPopupExtender ID="ModalPopupExtender6" runat="server" TargetControlID="btnNext" OkControlID="imgExitEdit1"
PopupControlID="pnl2" BackgroundCssClass="LoadingBackground" >
</asp:ModalPopupExtender>
<input type="hidden" runat="server" id="Hidden1" />
<asp:Panel runat="server" ID="pnl2" CssClass="Modal450h450w" Height="300px">
<table id="Table1" runat="server">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="right" colspan="2"><img runat="server" id="img1" src="../images/Exit_cross.png" /></td>
</tr>
<tr>
<td colspan="3">Some Label : </td>
<td colspan="3"><telerik:RadTextBox ID="txtSomeText" runat="server" CssClass="largebox"></telerik:RadTextBox></td>
</tr>
<tr>
<td colspan="4">
<asp:Button runat="server" ID="btnIbanClose" Text="Close" OnClick="btnAdd_Close_Click" />
</td>
<td align="right">
<asp:Button runat="server" ID="btnIbanReview" Text="Next" OnClick="btnEdit_Next_Click" />
</td>
</tr>
</table>
</asp:Panel>
The code behind :
protected void btnEdit_Next_Click(object sender, EventArgs e)
{
ModalPopupExtender6.Show();
}
I am thinking it's about the AutoPostBack but I am not sure how to resolve this
I have found the solution to this if anybody is interested.
What you need to do is create a hidden input field and set the TargetControlID to the hidden control and from there you are able to fire off the buttons event.
<input type="hidden" runat="server" id="hdnNext" />
<asp:ModalPopupExtender ID="ModalPopupExtender6" runat="server" TargetControlID="hdnNext" OkControlID="imgExitEdit1"
PopupControlID="pnlIban" BackgroundCssClass="LoadingBackground" >
</asp:ModalPopupExtender>
The input field is used in this case as a Dummy control where the ModalPopupExtender points to and from the buttons event you are able to control which other ModalPopupExtenders you want to control.
I want to Use only the HTML Controls on my page. For that i want to use some text boxes and a HTML select(List box) and a Submit button for Post Event.
The Code is as follows:
<script type="text/javascript">
function dropdown(mySel) {
var myWin, myVal;
myVal = mySel.options[mySel.selectedIndex].value;
if (myVal) {
if (mySel.form.target) myWin = parent[mySel.form.target];
else myWin = window;
if (!myWin) return true;
myWin.location = myVal;
}
return false;
}
</script>
This Java Script i am using for the HTML Select List.
The Rest of the Code are As follows:
<form action="feedback.aspx" method="post" onsubmit="return dropdown(this.feeds)">
<h1>
Let us know your inconvenience for the following Listing:
</h1>
<table>
<tr>
<td>
<b>Type : </b>
</td>
<td>
<asp:Label ID="lbltype" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<b>ID : </b>
</td>
<td>
<asp:Label ID="lblID" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<b>Title: </b>
</td>
<td>
<asp:Label ID="lblTitle" runat="server"></asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td>
User ID:
</td>
<td>
<input type="text" name="txtUserid" />
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="txtName" />
</td>
</tr>
<tr>
<td>
Contact:
</td>
<td>
<input type="text" name="txtContact" />
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="txtemail" />
</td>
</tr>
</table>
<br />
<table cellpadding="5" cellspacing="5" width="500px">
<tr>
<td style="width: 400px">
<b>Please Select the given option </b>
</td>
</tr>
<tr>
<td style="width: 400px">
<select name="feeds">
<option value="">Choose an Option...</option>
<option value="">Option1</option>
<option value="">Option2</option>
<option value="">Option3</option>
</select>
</td>
</tr>
<tr>
<td style="width: 400px">
<b>Write your Comment Here: </b>
<br />
<textarea id="TextArea" name="txtcomment" cols="45" rows="5"></textarea>
</td>
<td>
</td>
</tr>
<Efextra:Captcha ID="Captcha1" runat="server" TabIndex="29" ValidationErrorMessage="Verification Code"
ValidationGroup="Feeds" ValidationText="*"></Efextra:Captcha>
<tr>
<td>
<input type="submit" value="Submit FeedBack" validationgroup="Feeds" />
</td>
</tr>
</table>
</form>
I have a XML document having the following Format:
<?xml version="1.0" encoding="utf-8" ?>
<Feedback>
<Options>
<ID>0</ID>
<option>[Select your option]</option>
</Options>
<Options>
<ID>1</ID>
<option>I got Incomplete/wrong information posted here.</option>
</Options>
<Options>
<ID>2</ID>
<option>The Content is not in Proper Format.</option>
</Options>
<Options>
<ID>3</ID>
<option>How can get the similar type of properties?</option>
</Options>
<Options>
<ID>4</ID>
<option>This Listing is Sold and Still Displaying here.</option>
</Options>
<Options>
<ID>5</ID>
<option>I can not send SMS for this Listing.</option>
</Options>
<Options>
<ID>6</ID>
<option>I can not get the Contact Information of the owner of this post.</option>
</Options>
<Options>
<ID>7</ID>
<option>My problem is not given here!</option>
</Options>
</Feedback>
Now what i ahve to do is:
When Page load it checks whether the user is registered or not, if he/She is a registered user, the first four field [User ID, Name, Contact, Email] can be be loaded itself.
for this my code behind file assigns value like this:
User FeedUser = Propertywala.User.GetAuthUser();
Txt1.Text=Feeduser.UserID; and so on..
If he/she is not a registered user then User will get this field blank and i will get fetch all the filled values through Page.Request().
Second Issue is that i want to load the Option of select box from XML file which is above.
I am a newbie to this code and flow. so please anybody can help me doing this.
Thanks in Advance.
You'll need to assign the runat="server" attribute to the input type="text" controls as well. Then you can access them in codebehind just like a webcontrol. The same goes for your select html control.
For the Xml document you're going to need an XmlReader object. For the implementation of that, please look up MSDN
Finally i did it without using a single asp control. I solved the problem like this:
<form name="feedback" action="FeedBack.aspx">
<h1>
Let us know your inconvenience for the following Listing:
</h1>
<table>
<%if (IsUserLoggedIn) %>
<%{ %>
<tr>
<td>
<b>User ID:</b>
</td>
<td>
<input type="text" value="<%=VisitingUser.UserIdn%>" size="30" readonly="readonly" />
</td>
</tr>
<tr>
<td>
<b>Name:</b>
</td>
<td>
<input type="text" value="<%=VisitingUser.FullName%>" size="30" readonly="readonly" />
</td>
</tr>
<tr>
<td>
<b>Contact:</b>
</td>
<td>
<input type="text" value="<%=VisitingUser.MobileNumber %>" size="30" readonly="readonly" />
</td>
</tr>
<tr>
<td>
<b>Email:</b>
</td>
<td>
<input type="text" value="<%=VisitingUser.PrimaryEmail%>" size="30" readonly="readonly" />
</td>
</tr>
<%} %>
<%else%>
<%{ %><tr>
<td>
<h3>
Enter the Folowing details to submit the Feedback:
</h3>
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="txtName" />
</td>
</tr>
<tr>
<td>
Contact:
</td>
<td>
<input type="text" name="txtContact" />
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="txtEmail" />
</td>
</tr>
<%} %>
</table>
<br />
<%if (int.TryParse(Request.QueryString["property"], out Property)) %>
<%{ %>
<%Propertywala.Property prp = new Propertywala.Property(Property);%>
<%if (prp.OwnerId > 0) %>
<%{ %>
<table>
<tr>
<td>
<b>Property ID :</b>
</td>
<td>
<%=Property.ToString() %>
</td>
</tr>
<tr>
<td>
<b>Property Title :</b>
</td>
<td>
<%=prp.AutoGeneratedTitle %>
</td>
</tr>
</table>
<%} %>
<%} %>
<%else if (int.TryParse(Request.QueryString["project"], out Project)) %>
<%{ %>
<%Propertywala.Project prj = new Propertywala.Project(Project);%>
<%if (prj.UserId > 0) %>
<%{ %><table>
<tr>
<td>
<b>Project ID : </b>
</td>
<td>
<%=Project.ToString() %>
</td>
</tr>
<tr>
<td>
<b>Project Title : </b>
</td>
<td>
<%=prj.Title %>
</td>
</tr>
</table>
<%} %>
<%} %>
<table cellpadding="5" cellspacing="5" width="500px">
<tr>
<td style="width: 400px">
<b>Please Select the given option </b>
</td>
</tr>
<tr>
<td style="width: 400px">
<select name="feeds">
<%foreach (System.Xml.XmlNode xNode in FeedXmlList)%>
<%{ %>
<option value="<%=xNode.ChildNodes[1].InnerText%>">
<%=xNode.ChildNodes[1].InnerText%></option>
<%} %>
</select>
</td>
</tr>
<tr>
<td style="width: 400px">
<b>Write your Comment Here: </b>
<br />
<textarea name="txtcomment" cols="45" rows="5"></textarea>
</td>
<td>
</td>
</tr>
<Efextra:Captcha ID="Captcha1" runat="server" TabIndex="29" ValidationErrorMessage="Verification Code"
ValidationGroup="Feeds" ValidationText="*"></Efextra:Captcha>
<tr>
<td>
<input type="submit" value="Submit FeedBack" />
</td>
</tr>
</table>
</form>
And finally in Code behind file i just put some required condition and fetch all the html values through request.form, like this:
if (Request.HttpMethod.ToLower() == "post" && Request.Form.Count > 0)
{
if (!string.IsNullOrEmpty(Request.Form["feeds"]) || !string.IsNullOrEmpty(Request.Form["txtcomment"]))
{
if (!string.IsNullOrEmpty(Request["property"]) || !string.IsNullOrEmpty(Request["project"]))
{
if (IsUserLoggedIn||(!IsUserLoggedIn && !string.IsNullOrEmpty(Request["txtName"]) && !string.IsNullOrEmpty(Request["txtContact"]) && !string.IsNullOrEmpty(Request["txtEmail"])))
{
if (Request.Form["feeds"] != "[Select your option]")
{
Mail(Request.Form["feeds"], Request.Form["txtcomment"]);
}
else
{
Common.ClientMessage("Select the Option and Retry to Submit the feeds.", CommonConsts.AlertType.info);
}
}
else
{
Common.ClientMessage("Unregistered user must fill their name and Contact Details!", CommonConsts.AlertType.info);
}
}
}
}
What am I missing in my code to make display the calendar in my form. I get error object expected. C#
http://www.martinesexpress-inc.com/PhoneControl/MyOrders.aspx
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
</div>
<table class="style1" style="width:100%; color:black; background-color:orange; outline-color:Green; ">
<tr>
<td><b>Enter Start and End Dates</b></td>
</tr>
</table>
<p>
</p>
<table class="style1" style="width:100%; color:black; background-color:orange; outline-color:Green; ">
<tr>
<td>
</td>
<td><b>
Start Date</b></td>
<td><b>
End Date
<asp:PlaceHolder ID="phGoBack" runat="server">Go <a class="link" href="Default.aspx">Back</a></asp:PlaceHolder>
</b></td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:TextBox ID="txtFrom" CssClass="fields" runat="server"></asp:TextBox>
<img alt src="images/cal.gif" onclick="displayDatePicker("txtFrom");" />
</td>
<td>
<asp:TextBox ID="txtTo" CssClass="fields" runat="server"></asp:TextBox>
<img alt src="images/cal.gif" onclick="displayDatePicker('txtTo');" />
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Literal ID="litCountRecords" runat="server"></asp:Literal>
</td>
<td>
<asp:Button ID="btnRun" runat="server" onclick="btnRun_Click" Text="Run"
Width="37px" />
to pass a control to javascript, you use (this) not ('txtTo')
but that doesn't look like your problem.... this is not a jscript error.
Usually when you get:
[NullReferenceException: Object reference not set to an instance of an object.]
You're trying to use "something" that isn't an instance of an object/class.
Can we see some code behind?
I have code in html:
<form runat="server">
<table>
<tr>
<td>
From Date:
</td>
<td>
<input type="text" runat="server" id="txtDate" placeholder="YYYY-MM-DD"/>
</td>
</tr>
<tr>
<td>
Show Data:
</td>
<td>
<input type="radio" id="rbShowDataYes" name="chShowData" value="1" checked="checked"> Yes
<input type="radio" id="rbShowDataNo" name="chShowData" value="0"> No
</td>
</tr>
...
</form>
In c#, when I try to reach txtDate.Value, it is working, but rbShowDataYes.Checked not working saying that rbShowDataYes is not in the current context. Where is my mistake?
string value=chShowData.SelectedItem.Value.ToString();
bool isChecked = radioButton1.Checked;
if(isChecked )
value=radioButton1.Text;
else
value=radioButton2.Text;