|
automatically display on web page..
and how can i call a method at win app from the web sercive..
thanks!!
|
|
|
|
|
Hi everyone,
actually im working on asp.net i have designed a student details page called student.aspx, it has got the student id textbox, student name textbox and other related fields i have the student details table in my sqlserver database. Now on entering the student id it connects to the database and retrieves the details corresponding to the id entered. everything is perfect the only problem that i encountered is when i enter an id that is not present in the database i receive the following command
Invalid operationException was unhandled by user,Invalid attempt to read when no data is present.
I dont want this to happen instead i need to have the msg as "No Record Found" in a Label. how do i handle this error... Do please help me...
Thanx in advance...
|
|
|
|
|
HasRows returns a bool to indicate if you have any rows retuned, but it doesn't actually advanced the reader to the next (or first) row. You need to replace the call to HasRows with a call to Read(), which advanced the reader to the next row. Read() will return false if there are no more rows to read.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thanks 4 ur reply.. well what i mean i actually hav 10 records in my database with id staring from s001 to s010 now while retrieveing the data according to the id entered if i enter an id for eg s011 which is not present in the database i need to catch the exception and make it display as "No record found for s011" something like this. so should i use the try and catch exception.. If it is so, can u please advice me as to how to use it...
Thanx in advance
|
|
|
|
|
How could you retrives the data from database, you should check the result set for number of rows,like
sample codes:
for SqlDataReader:
SqlDataReader dr;
if (dr.HasRows == true)
{
//display records
}
else
{
//no records
}
if you are using datatable, dataset etc,use like the below one
DataTable dt;
if (dt.Rows.Count > 0)
{
//records found
}
else
{
//no records
}
|
|
|
|
|
Place you code inside a try/catch block and test for the number of rows returned first
try<br />
{<br />
DataTable dt = GetRecords();<br />
if( dt.rows.count == 0)<br />
label.Text = "No records found";<br />
else<br />
...<br />
}<br />
catch(Exception ex)<br />
{<br />
label.Text = ex.message;<br />
}
only two letters away from being an asset
|
|
|
|
|
We can send mail using System.Net.Mail namespace in ASP .NET. But do we have any API to read mails via POP server using ASP .NET? Please help as I have not come across any such thing. Will I be able to read every details of the mail i.e. all the headers and the body?
|
|
|
|
|
|
|
Hi...
I want to add functionality of drag and drop columns in gridview through javascript.
how can i do this....
Thanks.
Regards,
PUJA FALDU
|
|
|
|
|
i dont know what is the function of cookies in ASP.net and how to get the infromation stored in cookies
|
|
|
|
|
Muhammad Tufail 1979 wrote: i dont know what is the function of cookies in ASP.net and how to get the infromation stored in cookies
Have a look at this link
Beginner's Guide To ASP.NET Cookies
This may help you !
|
|
|
|
|
cookies are used to store the values in text files. Basically cookies are text files used to store data in it. So, the user can retrieve the data later from the cookies.
|
|
|
|
|
I think you're telling the wrong person.
|
|
|
|
|
|
Cookies are messages given to a Web browser by a Web server.
The main purpose of a cookie is to identify users and possibly prepare customized Web pages or to save site login information for you.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Manas Bhardwaj wrote: The main purposeSome possible uses of a cookie is to identify users and possibly prepare customized Web pages or to save site login information for you.
FTFY
|
|
|
|
|
I am trying to use an AnimationExtender to send blurb message in a details View. But failed to re enable the blurb button. Any type of help is appreciated Here is my code
Protected Sub dlSearch_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlSearch.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim itm As DataListItem = e.Item
Dim ani As AjaxControlToolkit.AnimationExtender = CType(itm.FindControl("OpenAnimation"), AjaxControlToolkit.AnimationExtender)
ani.TargetControlID = "btnInfo"
'ani.OnClick.Children(0).Properties("AnimationTarget") = ani.FindControl("btnInfo").ClientID
Dim str22 As String = ani.OnClick.Children(0).Properties("AnimationTarget")
ani.OnClick.Children(1).Properties("Script") = "Cover($get('" + ani.FindControl("btnInfo").ClientID + "'), $get('flyout'));"
Dim anic As AjaxControlToolkit.AnimationExtender = CType(itm.FindControl("CloseAnimation"), AjaxControlToolkit.AnimationExtender)
anic.TargetControlID = "btnClose"
Dim str As String = anic.OnClick.Children(7).Properties("AnimationTarget")
End If
End Sub
-----------------------------------------------------------
<asp:DataList ID="dlSearch" runat="server" DataKeyField="ProfileId">
<HeaderTemplate>
<asp:CheckBox ID="checkMain" runat="server" Text="Check All" onclick="checkunchkall(this);" />
<%-- <input id="checkMain" type="checkbox" runat="server" Text="Check All" onclick="checkunchkall(this);" />--%>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td Width="130">
<%-- <input id="chkAll" type="checkbox" Text="Select this Profile" runat="server" />--%>
<asp:CheckBox ID="chkAll" runat="server" Text="Select this Profile" />
</td>
<td align="right" colspan="2">
<asp:HyperLink ID="HyperLink1" Text="View Similar Profile" runat="server"></asp:HyperLink>
<asp:Button ID="btnInfo" runat="server" OnClientClick="return false;" Text="Send Blurb"/>
<ajaxToolkit:AnimationExtender id="OpenAnimation" runat="server" TargetControlID="btnInfo">
<Animations>
<OnClick>
<Sequence>
<%-- Disable the button so it can't be clicked again --%>
<EnableAction AnimationTarget="btnInfo" Enabled="false" />
<%-- Position the wire frame on top of the button and show it --%>
<ScriptAction Script="" />
<StyleAction AnimationTarget="flyout" Attribute="display" Value="block"/>
<%-- Move the wire frame from the button's bounds to the info panel's bounds --%>
<Parallel AnimationTarget="flyout" Duration=".3" Fps="25">
<Move Horizontal="-280" Vertical="10" />
<Resize Width="260" Height="100" />
<Color PropertyKey="backgroundColor" StartValue="#AAAAAA" EndValue="#FFFFFF" />
</Parallel>
<%-- Move the info panel on top of the wire frame, fade it in, and hide the frame --%>
<ScriptAction Script="Cover($get('flyout'), $get('info'), true);" />
<StyleAction AnimationTarget="info" Attribute="display" Value="block"/>
<FadeIn AnimationTarget="info" Duration=".2"/>
<StyleAction AnimationTarget="flyout" Attribute="display" Value="none"/>
<%-- Flash the text/border red and fade in the "close" button --%>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#666666" EndValue="#FF0000" />
<Color PropertyKey="borderColor" StartValue="#666666" EndValue="#FF0000" />
</Parallel>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#FF0000" EndValue="#666666" />
<Color PropertyKey="borderColor" StartValue="#FF0000" EndValue="#666666" />
<FadeIn AnimationTarget="btnCloseParent" MaximumOpacity=".9" />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>
<ajaxToolkit:AnimationExtender id="CloseAnimation" runat="server" TargetControlID="btnClose">
<Animations>
<OnClick>
<Sequence AnimationTarget="info">
<%-- Shrink the info panel out of view --%>
<StyleAction Attribute="overflow" Value="hidden"/>
<Parallel Duration=".3" Fps="15">
<Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />
<FadeOut />
</Parallel>
<%-- Reset the sample so it can be played again --%>
<StyleAction Attribute="display" Value="none"/>
<StyleAction Attribute="width" Value="250px"/>
<StyleAction Attribute="height" Value=""/>
<StyleAction Attribute="fontSize" Value="12px"/>
<OpacityAction AnimationTarget="btnCloseParent" Opacity="0" />
<%-- Enable the button so it can be played again
<Condition ConditionScript="$get('btnInfo') != null"></Condition>--%>
<EnableAction AnimationTarget="btnInfo" Enabled="true" />
</Sequence>
</OnClick>
<OnMouseOver>
<Color Duration=".2" PropertyKey="color" StartValue="#FFFFFF" EndValue="#FF0000" />
</OnMouseOver>
<OnMouseOut>
<Color Duration=".2" PropertyKey="color" StartValue="#FF0000" EndValue="#FFFFFF" />
</OnMouseOut>
</Animations>
</ajaxToolkit:AnimationExtender>
<!-- "Wire frame" div used to transition from the button to the info panel -->
<div id="flyout" style="display: none; overflow: hidden; z-index: 2; background-color: #FFFFFF; border: solid 1px #D0D0D0;"></div>
<!-- Info panel to be displayed as a flyout when the button is clicked -->
<div id="info" style="display: none; width: 250px; z-index: 2; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); font-size: 12px; border: solid 1px #CCCCCC; background-color:#ffffff ; padding: 5px;">
<div id="btnCloseParent" style="float: right; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);">
<asp:LinkButton id="btnClose" runat="server" OnClientClick="return false;" Text="X" ToolTip="Close"
Style="background-color: #666666; color: #FFFFFF; text-align: center; font-weight: bold; text-decoration: none; border: outset thin #FFFFFF; padding: 5px;" />
</div>
<div >
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Table runat="Server" ID="tblblurb">
<asp:TableRow>
<asp:TableCell>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:TableCell>
<asp:TableCell>
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</td>
</tr>
<tr>
<td >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="gvImages" runat="server" AllowPaging="True" onclick="" AutoGenerateColumns="False" OnPageIndexChanging="gvImages_PageIndexChanging" PageSize="1" GridLines="None" ShowHeader="False">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<img src='../Handler.ashx?Size=S&ImageID=<%# Eval("ImageId") %>' style="cursor:hand"
onclick="javascript:PopOpen('<%#Eval("ImageId")%>');" alt='Thumbnail Photo of <%# Eval("ImageId") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td style="text-align:justify; vertical-align:top">
<%-- tblProfile.ProfileName, tblProfile.ProfileId, tblProfile.Age, tblProfile.Gender, tblProfile.MaritalStatus, tblHeight.HeightInch, tblHeight.HeightCm,
tblWeight.WeightKg, tblWeight.WeightLbs, tblEducationCategory.EducationName, tblProfile.StateName, tblCaste.CasteName,
tblReligion.ReligionName
--%>
<asp:Table runat="server" id="tblProfileDetails" width="400" >
<asp:TableRow ID="TableRow1" runat="server" >
<asp:TableCell ID="TableCell2" ColumnSpan="3" runat="server"><h5> <%# Eval("ProfileName") %> (<%# Eval("Age") %>yrs) </h5></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow2" runat="server" >
<asp:TableCell ID="TableCell4" runat="server"><%# Eval("MaritalStatus") %> </t> <%# Eval("Gender") %></asp:TableCell>
<asp:TableCell ID="TableCell18" runat="server"><%# Eval("EducationName") %> </t> <%# Eval("StateName") %></asp:TableCell>
<asp:TableCell ID="TableCell20" runat="server"><%# Eval("CasteName") %></asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow4" runat="server" >
<asp:TableCell ID="TableCell14" runat="server"><%# Eval("WeightKg") %>kg/<%# Eval("WeightLbs") %>lbs</asp:TableCell>
<asp:TableCell ID="TableCell10" runat="server"><%# Eval("HeightInch") %>/<%# Eval("HeightCm") %>cm</asp:TableCell>
</asp:TableRow>
</asp:Table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
|
|
|
|
|
I am new to ASP.NET, I am trying to debug ASP.NET application (C#).
I placed break point and excuting debuging verion from the VS,
but the control is not reaching any breaking point, atlease even Form_Load,page is getting
loaded completely.
Please advive
|
|
|
|
|
|
Did that , but now luck,,
And also tried
1. Open RegEdit
2. Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3. Add a dword under this key called TabProcGrowth
4. Set TabProcGrowth to 0
Additional to it you need to do this
1. Open Internet Explorer
2. Go to Tools->Internet Options
3. Switch to the Advanced tab
4. Uncheck 'Disable script debugging (internet explorer)'
But no luck
|
|
|
|
|
What is the location of you application ? is it from file System or IIS ?
|
|
|
|
|
no it is c:\somefolder, I tried placing it in othere locations /even desk top with out luck
|
|
|
|
|
Are you sure you're running a debug version of the application rather than a release version? Check the project properties.
|
|
|
|
|
Oh Yes , it is debug build, I am c++ programmer, new to asp.net
I may be missing a small thing, but not sure of what ? pls help me out
|
|
|
|