|
You might find your answer in the thread that was posted yesterday with the same subject and the same question... by the same user...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I m trying to set up an image gallery using flash.
These images and texts will be fetched from database and will be displayed in swf.
Can anyone suggest me any good article on this.
Regards
Vijay V.
Yash Softech
|
|
|
|
|
how send message through network in asp.net.
|
|
|
|
|
|
Are you talking about Mailmessages
Cheers!!
Brij
|
|
|
|
|
hi,
here is the way for mail message..
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
MailAddress SendFrom = new MailAddress(txtFrom.Text);
MailAddress SendTo = new MailAddress(txtTo.Text);
MailMessage MyMessage = new MailMessage(SendFrom, SendTo);
MyMessage.Subject = txtSubject.Text;
MyMessage.Body = txtBody.Text;
Attachment attachFile = new Attachment(txtAttachmentPath.Text);
MyMessage.Attachments.Add(attachFile);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
emailClient.Send(MyMessage);
litStatus.Text = "Message Sent";
}
catch (Exception ex)
{
litStatus.Text=ex.ToString();
}
}
Regards
Anil
Anil Pandey
|
|
|
|
|
Hi I have created the menu, the values for the menu control is from database near about 1000 items. When I test this menu in IE7 it will respond very slowly, is there any resolution for that
thanks,
Sarang
|
|
|
|
|
I need to stick with this format. No binding in the default.aspx source view page. I want to select a row and have that row populate the corresponding textboxes in default2.aspx. In other words if row id 213-46-8915 is selected the last name Green and first name Marjorie will show up in default2.aspx page textboxes. I got those values from the pubs database.
Default.aspx <asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
<columns> <asp:templatefield showheader="False">
<itemtemplate>
<asp:linkbutton id="LinkButton1" runat="server" causesvalidation="False">
CommandName="Select" Text="Select">
code behind:
protected void Page_Load(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
var products = from p in db.authors
select p;
GridView1.DataSource = products;
GridView1.DataBind();
} Default2.aspx
au_lname<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown">
au_fname
<asp:textbox id="TextBox2" runat="server" xmlns:asp="#unknown">
|
|
|
|
|
i have a page i call admin that has a detailsview on it
i have a page i call hiking with a gridview on it
i can insert edit and delete ok but if i delete all the records with the detailsview the control dissappears what can i do to stop this?
|
|
|
|
|
Hi all,
I have a literal inside of a panel as such:
<asp:panel scrollbars="Vertical" id="Panel1" runat="server" xmlns:asp="#unknown"><asp:literal id="Literal1" runat="server" /></asp:panel>
I am setting the literal to be some HTML text. The literal grows, the panel's scrollbars show up, everything is great. I'm using the following code to maintain the position of the panel's scrollbar during postback:
<script type="text/javascript">
var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
function BeginRequestHandler(sender, args) {
if ($get('<%= Panel1.ClientID %>') != null) {
xPos = $get('<%= Panel1.ClientID %>').scrollLeft;
yPos = $get('<%= Panel1.ClientID %>').scrollTop;
}
}
function EndRequestHandler(sender, args) {
if ($get('<%= Panel1.ClientID %>') != null) {
$get('<%= Panel1.ClientID %>').scrollleft = xPos;
$get('<%= Panel1.ClientID %>').scrollTop = yPos;
}
}
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
</script>
That works great, too. Now for the problem: When the user has the panel scrolled all the way to the bottom, they can't see the newly added text to the Literal without scrolling the panel down. Is there a way that I can automatically scroll the panel down? Ideally, I want to automatically scroll the panel if the scroll position is near the bottom. (If the scroll position is near the top I don't want to scroll because they might be trying to read something and that's annoying to keep going back and forth.)
Thanks everyone
|
|
|
|
|
I think I got it. But I'll wait until tomorrow to test it thoroughly.
But, if anyone has any ideas I'd appreciate it because I'm sure my way sucks bad.
|
|
|
|
|
I would give my panel a real name, not Panel1. Then I would have one piece of script that creates a javascript variable that contains the client ID. I would use that in the rest of my script, it makes it more readable.
These are questions of style, not substance, but they make your code more readable.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Good grief. For simplicity I just used Panel and Literal in my post. Seeing as how most of the people here can't spell the most basic English words right, I thought I'd make it as easy as possible on them. My question didn't pertain to readability. If you can't answer my question, then please don't reply just for the sake of posting something.
|
|
|
|
|
Well, most people post the actual code here - how can we comment on your code, if you post pretend code ? And a LOT of people use the default variable names, I can't tell you how often people post code with textbox1 through textbox12 and wonder why their code is unreadable.
And surely you didn't copy/paste the inline ClientID every time, when you're doing things nicely and using a variable ? I never post for the sake of posting. If you like, I'll make a mental note not to try to help you in future, will that work for you ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
The panel is named MessagesPanel, and the literal is named ContentsLiteral. ClientID isn't an issue when it's already there. As we both know, the names don't factor whatsoever into any solution.
It's not "pretend code." When I posted the message, I copied my exact code into the question and just renamed the controls. I just replaced the names to reduce confusion. Sorry if I flew off the handle, but that wasn't what I was looking for.
|
|
|
|
|
i have a CheckBoxList inside a DataList, i bind the CheckBoxList in the DataList ItemDataBound event, everything is working fine except that i lose the datasource of the checkboxlist within any postback, i bind my datalist in the Page_Load event inside if(!IsPostBack) .. i know i could bind my datalist outside this if condition and that should make it work,
but it will cause re-loading the data every postback beside i did some clientside scripting that lets the user manipulate some controls without postback, so the data will not look the same if i reloaded it everytime.
i hope theres a solution or any workaround
any help ?
thanks in advance.
|
|
|
|
|
The checkboxlist data should remain even after a post back as long as you are not rebinding the DataList.
Any changes you make via javascript will be undone after a postback because the page will re-render the original html of the control.
One trick around this is to set the value of hidden fields in javascript and then during the postback check those hidden fields and do the same work with server side code that you did with javascript.
I didn't get any requirements for the signature
|
|
|
|
|
i think the checkboxlist has a problem, i know that the datasource should remain after post backs and thats all controls do except the checkboxlist, i dunno
and yea, i do set attributes and hidden fields to read the data and it works fine, the problem is that i cant read the datasource of the checkboxlist after postbacks.
any idea ?
thanks for replying
|
|
|
|
|
The only thing I can think of is to use a DataTable as the checkbox list's source and store the datatable in viewstate. Then you can rebind it on every postback if you must.
I didn't get any requirements for the signature
|
|
|
|
|
yea i think too ...
thanks much for ur time.
|
|
|
|
|
Hello all,
I am having a issue that for the life of me is driving me nuts!, hopefully someone here can shed some light as to what i am doing wrong?
Code Follows(C#)
try
{
SqlDataReader myDR = DataConnElement.ReturnDataReaderSP("upGetAllMachineNames");
MachineNameList.DataSource = myDR;
MachineNameList.DataValueField = "MachineName_ID";
MachineNameList.DataTextField = "MachineName_Title";
MachineNameList.DataBind();
}
catch (Exception ex) //just used for debugging (not able to write to error file atm)
{
Response.Write(ex.StackTrace.ToString());
Response.Write(ex.Message.ToString());
}
//The Procedure that is called (ReturnDataReaderSP)
public SqlDataReader ReturnDataReaderSP(string StoredProcedureTitle)
{
try
{
using (sqlconn)
{
sqlconn = new SqlConnection(ConnString);
SqlCommand sqlcomm = new SqlCommand(StoredProcedureTitle, sqlconn);
using (sqlcomm)
{
sqlcomm.CommandType = CommandType.StoredProcedure;
sqlconn.Open();
SqlDR = sqlcomm.ExecuteReader(CommandBehavior.CloseConnection);
return SqlDR;
}
}
}
finally
{
sqlconn.Close();
}
}
|
|
|
|
|
Datareader is only valid as long as the connection is open. It is a fast-forward read-only cursor in the DB. You need to read the data into a collection, then close the connection and pass the newly created connection to the datasource. One common method:
using(SqlDataReader reader = command.ExecuteReader()){
while(reader.Read()){
Customer customer = new Customer();
customer.Populate(reader);
listOfCustomers.Add(customer);
}
}
connection.Close();
return listOfCustomers;
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Hello,
I'm using a radiobuttonlist with 5 listitem, depending on the user choice a different view will be diplayed. All this is placed in an updatePanel control to avoid refreshing the whole page on each Radio button change click. Everything works fine except when initially a radiobuttonlist item is by default selected in my aspx code. What happens is all other radiobuttons click refresh the view except when i click back on the previous default selected radiobutton. Any ideas how I can resolve this in a neat way? I obsolutley have to have the first RadioButton selected by default cause it's a none view selection.
Please find below part of the code I'm using.
<pre><asp:RadioButtonList ID="ExpressionSystemRB" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ExpressionSystemRB_SelectedIndexChanged" RepeatDirection="Horizontal">
<asp:ListItem Text="None" Value="none" Selected="True"></asp:ListItem>
<asp:ListItem Text="Hybridoma" Value="hybridoma"></asp:ListItem>
<asp:ListItem Text="Stable cell line" Value="cellLine"></asp:ListItem>
<asp:ListItem Text="Transient expression" Value="transient"></asp:ListItem>
<asp:ListItem Text="Recombiniant stain" Value="recombiniant"></asp:ListItem>
</asp:RadioButtonList>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ExpressionSystemRB" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:MultiView ID="ProductionInfoMultiView" runat="server" ActiveViewIndex="0">
<asp:View ID="noneView" runat="server" >
// empty view
</asp:View>
<asp:View ID="hybridomaView" runat="server" >
// view 1 table display
</asp:View>
<asp:View ID="cellineView" runat="server">
// view 2 new table display
</asp:View>
<asp:View ID="transientView" runat="server">
// view 3 new table display
</asp:View>
<asp:View ID="recombiniantView" runat="server">
// view 4 new table display
</asp:View>
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel></pre>
***************************
so if I put a selectedvalue=true like this
<code><asp:ListItem Text="None" Value="none" Selected="True"></asp:ListItem></code>
whenever i click on the none RB the view won't refresh but if i take the selected = true out everything works fine!!!
her'es the codebehind of the method i call on each RB click
<pre>protected void ExpressionSystemRB_SelectedIndexChanged(object sender, EventArgs e)
{
if (ExpressionSystemRB.SelectedValue == "none")
{
ProductionInfoMultiView.SetActiveView(noneView);
}
else if (ExpressionSystemRB.SelectedValue == "hybridoma")
{
ProductionInfoMultiView.SetActiveView(hybridomaView);
}
else if (ExpressionSystemRB.SelectedValue == "cellLine")
{
ProductionInfoMultiView.SetActiveView(cellineView);
}
else if (ExpressionSystemRB.SelectedValue == "transient")
{
ProductionInfoMultiView.SetActiveView(transientView);
}
else if (ExpressionSystemRB.SelectedValue == "recombiniant")
{
ProductionInfoMultiView.SetActiveView(recombiniantView);
}
}</pre>
Thanx in advance for your help!
|
|
|
|
|
Don't set the value with codebehind. maybe you can set the default with javascript using page.registerstartupscriptblock. Then it will post back.
I didn't get any requirements for the signature
|
|
|
|
|
Thank you for your answer but in the main time I found a way to do so without using javascript!
So basically as my RadioButton has to be refreshed too, I saw on a site that it's better to put my RadioButton inside the UpdatePanel and the <contentTemplate>. So here's how my code is now and it works perfectly!
<pre><asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="ExpressionSystemRB" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ExpressionSystemRB_SelectedIndexChanged" RepeatDirection="Horizontal">
<asp:ListItem Text="None" Value="none" Selected="True"></asp:ListItem>
<asp:ListItem Text="Hybridoma" Value="hybridoma"></asp:ListItem>
<asp:ListItem Text="Stable cell line" Value="cellLine"></asp:ListItem>
<asp:ListItem Text="Transient expression" Value="transient"></asp:ListItem>
<asp:ListItem Text="Recombiniant stain" Value="recombiniant"></asp:ListItem>
</asp:RadioButtonList>
<asp:MultiView ID="ProductionInfoMultiView" runat="server" ActiveViewIndex="0">
<asp:View ID="noneView" runat="server" >
// empty view
</asp:View>
<asp:View ID="hybridomaView" runat="server" >
// view 1 table display
</asp:View>
<asp:View ID="cellineView" runat="server">
// view 2 new table display
</asp:View>
<asp:View ID="transientView" runat="server">
// view 3 new table display
</asp:View>
<asp:View ID="recombiniantView" runat="server">
// view 4 new table display
</asp:View>
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel></pre>
|
|
|
|