|
we can't do paging with datareader becoz it is forward only not backword
and it is connection oriented.
|
|
|
|
|
actually am designing a datagrid wich posses same appearence as inbox .
when i pressed the delete button i want to delete the records ,wich i checked (more than one).
aswell, how to select all the checkboxes in the template column on the click of a checkbox present in the header template of template column
plz give me solution..!
yuva.charan@gmail.com
|
|
|
|
|
You just got lucky! Put the following javascript within the <head>...</head> tags in your web form:
<script language="javascript" type="text/javascript">
function SelectAllCheckboxes(spanChk)
{
// Added as ASPX uses SPAN for checkbox
var oItem = spanChk.children;
var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
xState=theBox.checked;
elm=theBox.form.elements;
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
if(elm[i].checked!=xState)
elm[i].click();
}
}
</script>
Then, you will have to add templated checkbox field in your dGridView, and Im hoping you know how to do that. Once you make that templated field, drag a checkbox in the ItemTemplate AND HeaderTemplate. Name the HeaderTemplate's checkbox "chkAll" and name the ItemTemplate's checkbox "yourCheckBox". Then follow the below schema for the onClick event:
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:CheckBox id="yourCheckBox" runat="server" />
</ItemTemplate>
<HeaderTemplate>Select All
<asp:CheckBox onclick="javascript:SelectAllCheckboxes(this);" id="chkAll" runat="server">
</asp:CheckBox>
</HeaderTemplate>
</asp:TemplateField>
To process the checked rows through an event handler, put in a button and get the onClick event handler ready, then do as below:
protected void yourButton_Click(object sender, EventArgs e)
{
yourObject = new yourClass();
int count = GridView1.Rows.Count;
for (int i = 0; i < count; i++)
{
//access each CheckBox from the TemplateField
CheckBox cb = (CheckBox)(GridView1.Rows[i].FindControl("yourCheckBox"));
//If it's checked, process it...
if (cb.Checked)
{
//do your thing!
yourObject.doWhatYouDo(GridView1.Rows[i].Cells[2].Text); //the Cells[2] points to the data within third column, it can be anything
}
}
yourObject.Dispose();
}
Let me know if you need help
Nila
|
|
|
|
|
Hi,
I am using Webservice VS 2005. How to change response XML encoding style from UTF-8 to other formats.Is it possible possible by setting any attributes.
Regards
|
|
|
|
|
Hai,
here i got a problem with Panel,I ma using 4 different panels(different 4 forms fields) in a same location which are belongs to different tables(data).and for all these i have only single ADD,Edit and Save Buttons.
My exact problem is ,
when i click on First panel for AddButton,If i click on save it should go to the next panel fields.|I have to SAVE only when alll other panels(forms) data inserted.Same case in EditMode also..
How to do this???wat exactly i should use to rectify this??
Give me some idea so that i can proceed.
Can anyone respond to this
Thanks in advance.
-- modified at 2:01 Thursday 16th November, 2006
kissy
|
|
|
|
|
There are some set of server controls its property enabled= may be true or false,now in code behind how to find its current state and i am getting the controls id during runtime like this
foreach(Control c in form1.Controls)
{
............
}
Thanks In Advance
|
|
|
|
|
Hi,
You have to cast the control first like
foreach (Control c in form1.Controls)
{
if (c.ID == lnkLink) //where lnkLink is the ID of the control
{
LinkButton link = (LinkButton)c; //cast control object to whatever control it should be (ie. LinkButton, TextBox, etc.)
bool status = c.Enabled;
...
}
}
|
|
|
|
|
Dear CPians,
I am trying to enable OutpoutCache on a UserControl which is dynamically added to the page. I get an exception when I instantiate the UserControl. The code goes as follows:
DisplayTime myUserControl;<br />
myUserControl = (DisplayTime)LoadControl("DisplayTime.ascx");
If I do not have an OutputCache directive it works fine. When I add the following:
<br />
<%@ OutputCache Duration="20" VaryByParam="*" Shared="true" %>
I get the following exception:
System.InvalidCastException: Unable to cast object of type 'System.Web.UI.PartialCachingControl' to type 'TestApp.DisplayTime'.
Any Ideas?
|
|
|
|
|
|
i hv created an application in which there are two panels(here throughout the msg panel stands for atlas:UpdatePanel) firsth panel contains some text boxes and the second one contains a datagrid ;second panel displays below the first panel and on the top of the oage i m hving one img of "-" sign .now when you click on that"-" sign it gets coverted into "+" sign and the panel 1 ; which is hving text boxes ; gets disappear for this i m using this javascript----
function toggleBlock(elementId,id) {
var element = document.getElementById(elementId);
var img = document.getElementById(id);
if(element.style.display == 'block'){
img.src="Images/plus.gif"
img.alt="Show Container"
element.style.display = 'none';
}else{
img.alt="Hide Container"
img.src="Images/minus.gif"
element.style.display = 'block';
}
}
but now if i create a multi tab page then i click on "-" img it will work fine for first tab but for 2nd 3rd and so on tabs it shows the contents of 1 st tab below that contents of the currentlly active tab and below that datagrid. so plz help me as soon as possible.
thanx in advance.
|
|
|
|
|
Friends, i am new to web development and currently exploring ASP.NET 2.0.
What i want is that, whenever user clicks on a link of my page, only the part of my page gets load and not the entire page. How can i do this in VS.NET 2005 ? Some one told me that this is a concept of frames which are not supported in VS.NET. Is that true, if yes that why this feature is missing from a quality product like VS 2005, there must be certain reason ?
Imtiaz
|
|
|
|
|
Of course you can use frames, but you can not work with them on server side (in ASP.NET code), because frames are pure client side stuff. You can write JavaScript to control frames and register it with your page (which is supposed to be part of frameset). I can tell you from my experience, frames are pain! If you don't need to use them, then don't use them.
|
|
|
|
|
|
How to populate the form fields (say, textbox,checkbox) of a microsoft word doc using asp.net?
vijeta
|
|
|
|
|
hi all,
i placed a jscript menu on the top of the page, and below it there is a dropdownlist. when i click on menu, some menuitems are overlaped by dropdownlist. how can i solve this problem...
thanks in advance...
Regards...
Amit
|
|
|
|
|
Upgrade to IE7 hehe!
Problem is in the way ddl's are rendered - as windowed elements, there are several solutions around (google helps), but none particularly elegant...
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
If your menu works using div tags, then one method is to place an iframe 'under' your div tag (making it the same size as the div). This should hide the dropdownlist.
|
|
|
|
|
Hello,
I created an ASP.NET 2.0 custom control which includes various TextBoxes, Labels and a button.
Basically is a contact form. When the button is pressed the values are sent by email.
I want to use the mailSettings values in my Web.Config file.
Everything works fine if I use in my bSubmit function:
smtpClient.Host = "mail.domain.com"
smtpClient.Port = "25"
smtpClient.UseDefaultCredentials = False
smtpClient.Credentials = New Net.NetworkCredential("user@domain.com", "password")
smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
But if I don't include this code I get the error:
System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such user here at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at MyNamespace.Web.UI.Form.Contact.bSubmit_Click(Object sender, EventArgs e)
Shouldn't it be using the Web.Config values?
And if yes, why am I getting an error if the values are the same:
<system.net>
<mailSettings>
<smtp deliveryMethod = "network">
<network
defaultCredentials = "true"
host = "mail.domain.com"
password = "password"
port = "25"
userName = "user@domain.com" />
</smtp>
</mailSettings>
</system.net>
My bSubmit_Click function, inside my custom control, is the following:
Private Sub bSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bSubmit.Click
' Create new mail message
Dim message As New System.Net.Mail.MailMessage
' Define mail message properties
With message
' Define various properties
.To.Add(New System.Net.Mail.MailAddress(Me.ToAddress, Me.ToName))
.Body = tbMessage.Text
.IsBodyHtml = True
' Define fromMailAddress
If Me.NameVisible Then
.From = New System.Net.Mail.MailAddress(tbEmail.Text, tbName.Text)
Else
.From = New System.Net.Mail.MailAddress(tbEmail.Text)
End If
' Define subject
If Me.SubjectVisible Then
.Subject = tbSubject.Text
End If
End With
' Define a new mail SMTP client
Dim smtpClient As New System.Net.Mail.SmtpClient
' Send the mail message and define sent property
Try
' Send the mail message
smtpClient.Send(message)
' Define sent property
Me.Sent = True
Catch ex As Exception
' Define sent property
Me.Sent = False
End Try
' Raise the OnFormSubmited event
RaiseEvent FormSubmited(Me, EventArgs.Empty)
End Sub
Thanks,
Miguel
|
|
|
|
|
I am getting problem in generating new GUID using its constructor who takes one string argument. like this
Guid regionID = new Guid(this.State.SelectedValue);
state gives 2 digit state code.The error says you need 32 digit with 4 dashes string to generate GUID.
any solutions ?
Amit Champaneri
|
|
|
|
|
That's right, because GUID is basically 16 bytes separated in certain places by 4 dashes...
You can not have GUID with only two bytes.
If you want, you can do it like this:
byte[] guidBytes = new byte[16];<br />
<br />
Random rand = new Random();<br />
rand.NextBytes(quidBytes);<br />
<br />
guidBites[0] = Convert.ToByte(this.State.SelectedValue[0]);<br />
guidBites[1] = Convert.ToByte(this.State.SelectedValue[1]);<br />
<br />
Guid myGuid = new Guid(guidBytes);
this should works
Pilo
|
|
|
|
|
This solution is really unlikely to help the OP because you have not taken into account what he might actually want a GUID for. You need to try to look at the bigger picture when answering questions because most are asking questions because they've got themselves in to a bit of confusion about something. Subsequently they may not ask the best question to get the answer they need.
|
|
|
|
|
I think you are confused about what a GUID actually is.
A Guid is a value that is generated by the system to be Globally (as in the world) unique. You should be able to generate as many guid values as you like on your machine and so could everyone else, but every value would always be unique.
|
|
|
|
|
plzz help me in data conversion of .mdb into .html format
i want to tranfer my database file on to web server.
it is not possible in C# as told by guffa. So is it possible in ASP.Net
regards
Shriya
|
|
|
|
|
You want to convert an access database into html? In what way? And why?
ASP.net runs off C# (or VB.net or whatever) - it's just a term to describe the web implementation of it.
|
|
|
|
|
I think you really need to define your requirements a bit better here.
Do you want to transfer data from your local server to the web server so that it then is stored in a DB on the webserver? Or is it that you just want static pages of html with teh data for display (and i would question why you would do that)?
|
|
|
|