|
laziale wrote: not GridViewCommandEventArgs, since with GridViewCommandEventArgs nothing is happening
Can you post your code?Cheers!!
Brij
|
|
|
|
|
hello
thx for your reply and here is my code:
backend:
protected void updateNote(object sender, GridViewCommandEventArgs e)
{
string selectedIndex = "";
int index = 0;
index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = gvOrderNotes.Rows[index];
ListItem item = new ListItem();
item.Text = Server.HtmlDecode(row.Cells[3].Text);
selectedIndex = item.Text;
}
html:
<ItemTemplate>
<asp:Button runat="server" ID="ChkUpdate" onclick="updateNote" AutoPostBack="true" Width="160%" Text="Update Order"/>
<ajaxToolkit:ConfirmButtonExtender ID="chkUpdateConfirmBtnExtender" runat="server" TargetControlID="chkUpdate" DisplayModalPopupID="modalPopupExtenderChkUpdate"></ajaxToolkit:ConfirmButtonExtender>
<ajaxToolkit:ModalPopupExtender ID="modalPopupExtenderChkUpdate" runat="server" TargetControlID="chkUpdate" PopupControlID="pnlChkUpdate"
OKControlID="chkUpdateOK" CancelControlID="chkUpdateCancel" BackgroundCssClass="modalBackground" />
</ItemTemplate>
Thx for your help one more time.
Laziale
|
|
|
|
|
Why dont you use rowcommand event of gridview..
use your button like in the linkCheers!!
Brij
|
|
|
|
|
You have to use e.RowIndex , where e is EventArgs .
|
|
|
|
|
there is no rowIndex under EventArgs e.
I have just Equals, GetHashCode, GetType and ToString.
Thx for your help though.
Laziale
|
|
|
|
|
try this,
Add commandArgument in <asp:button> tag
<asp:Button ID="Button1" runat="server" Text='<%#Eval("YourDataFiled")%>'
CommandArgument = "Button1" OnClick = "Button1_Click" />
c# code
protected void Button1_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
string CommandName = button.CommandName;
string CommandArgument = button.CommandArgument;
int index = Int32.parse(button.CommandArgument);
}
Hope this helps.
|
|
|
|
|
Hei,
I've some special characters like æ ø å and when I use these chars it display correct in the label but when i bind that field with a Gv they are converted in to ø or any other number at the place of 248. What is the solution for this problem.
ThanksSyed Shahid Hussain
|
|
|
|
|
To handle special characters,you can use javascript functions escape() and unescape() to encode and decode.this will allow to display the special charactersCheers!!
Brij
|
|
|
|
|
Thanks Brij Syed Shahid Hussain
|
|
|
|
|
Just, set the HtmlEncode property of your BoundField to False.
Like:
<asp:boundfield datafield="Character" headertext="Character" htmlencode="false" />
</asp:gridview>
|
|
|
|
|
Hei
Thanks a lot Sandeep Mewara You had solved my problem.
for u Syed Shahid Hussain
|
|
|
|
|
Hi All,
I need to implement on my form, a feature to automaticaly store the old value of the cotnroles on a database if the user press a button to save the value. One way is to code it for each control on the ButtonClick event but it's too heavy to do and no fearly nice.
So, a good way is to declare inherited controls, add properties and declare events. On the form, when the user press the button, raise the event and for each control whose has the value changed and saved it to disk.
I need also to pass arguments on the Event to stored it on the database.
I have implemented the following but the event on the custom controls is not fired. So I do not know what is wrong.
First:
On the /APP_Code subdirectory, I have created a class called "MyControls" like this:
namespace MyControls
'need this class to customize argumentso to pass in tge event
Public Class SaveEventArges
myproperties...
End Class
Public Delegate Sub SaveEventHandler (ByVal sender As Object, ByVal e as SaveEventArgs)
Public Class ComboBox
Inherits .....
myproperties and methods ...
Public Event Save as SaveEventHandler
Protected Overridable Sub OnSave (ByVal sender As Object, ByVal e as SaveEventArgs)
RaiseEvent Save(me, e)
End Sub
Protected Sub ComboBox_Save ( ByVal sender As Object, ByVal e as SaveEventArgs) Handles Me.Save
mySaveCode
End Sub
End Class
end namespace
Second: On my form
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" >
<%@ Register TagPrefix = "mc" Namespace = "MyControls" %>
...
<mc:combobox runat="server" id="TextComboBox" ><="" mio:combobox="">
<asp:button runat="server" id="Btn" text="Press">
....
On the code behind:
Imports MyControls
....
Public Event Save As SaveEventHandler
Protected Sub Btn_Click ....
Dim t as New SaveEventArgs
my t... properties to pass to the event
RaiseEvent Save (me., t)
End Sub
What am I doing wrong?
I spent 4 days reading how to do it and no way to found a solution, so please i need your help.
RegardsJulien Lacotse
|
|
|
|
|
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time.
1. Fill data with sqldatasource.
2. Fill datatable and bind with GridView.
To fill data with datatable to get data I use this code -
SqlConnection cnSql = new SqlConnection(strConn);
cnSql.Open();
SqlCommand cmd = new SqlCommand(StrSql, cnSql);
cmd.CommandTimeout = 50000;
cmd.ResetCommandTimeout();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
is there any problem with my code or I have to change some configuration in my web.config ?
|
|
|
|
|
res.manish wrote: I have bulk of data of client information aprox 15000.
This is not an good idea to showing this amount of data In gridview at time.
What you can do
1. Use Filter Criteria and based on that allow to retrieve Data. Because, there is no sense to load 15,000 at a time, as no one going to check those data at time.
So, use filter criteria.
2. Use Caching , To Reduce the performance hit. If the data is common for all user, use dataCaching , use filter from Cached data itself. Use Cache Dependency if you want to update cache if some changes in data.
Hope this will help you !
|
|
|
|
|
Apart from Abhijit's suggestion you may also wish to consider one or more of other methods of displaying data. Some of them are: Paging, Grouping of Records, Pivoting, or using Graphs or charts.
The main idea is just don't dump a lot of data to the client browser. Secondly, user can analyse the data if the number of rows are lesser.
|
|
|
|
|
As Anurag & Abhijit suggested,use some filter criteria.If there is no criteria then use paging.Also it'll be better if you do the paging at databse level itself. Cheers!!
Brij
|
|
|
|
|
|
Hi Guys
I am working with C# and facing a problem at deployment level
In application, if anywhere coming error it getting redirected to login page
and session removing with Session.Abandon
while Again Trying to login Giving error "Internal .Net Framework Data Provider error 12."
I am using business layer and every query is executing from business Layer
Before executing any query i am opening Connection string & then closing Connection
So Why this error is coming ?
if any one knows. plz help me
thanks in advanced..krishna veer singh
|
|
|
|
|
Hi All,
How to call Activex Control methods using javascripts?
In below code...
i am calling a funtion
ActiveXControl.Read()..which is throwing a error
"Object doesn't support this property or method".
But, before calling this method..
i am assigning a value to Activex control Property as....
ActiveXControl.MyParam = "Hello Friends!" which works fine.
Why does the method throw error when propety works fine?
Please guide me.
Thanks in advance.
|
|
|
|
|
Prasadsm wrote: "Object doesn't support this property or method".
I am not sure about the code, but just asking which browser you are using? ActiveX Control works only in IE Browser.
|
|
|
|
|
|
Hello,
i have code to send smtp mail from local system and from configured server.
when i use to send email with all options like from,to,cc and bcc as per the below code
local server(system code works like)
Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration("~/Web.config");
MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
if (mailSettings != null)
{
port = mailSettings.Smtp.Network.Port;
host = mailSettings.Smtp.Network.Host;
password = mailSettings.Smtp.Network.Password;
username = mailSettings.Smtp.Network.UserName;
}
MailMessage message = new MailMessage(FromAddress, ToAddress, EMailSubject, EMailBody);
if (string.IsNullOrEmpty(ToAddress))
{
message.To.Clear();
message.CC.Clear();
}
else
{
message.CC.Add(ToAddress);
message.To.Clear();
}
if (!string.IsNullOrEmpty(BccAddress))
message.Bcc.Add(BccAddress);
message.IsBodyHtml = IsHTMLFormat;
SmtpClient mySMTPclient = new SmtpClient(host, port);
NetworkCredential userCredetials = new NetworkCredential(username, password);
mySMTPclient.UseDefaultCredentials = false;
mySMTPclient.Credentials = userCredetials;
mySMTPclient.EnableSsl = true;
mySMTPclient.Send(message);
then it is working fine.
from the above code all the mails will be sent from one singe from address like "abc.gmail.com" irrespective of from address at runtime.
from the hosting server
to accomplish this i have used code as below
System.Web.Mail.MailMessage mailMessage = new System.Web.Mail.MailMessage();
mailMessage.From = FromAddress;
if (!string.IsNullOrEmpty(BccAddress))
{
BccAddress = BccAddress.Replace(",", ";");
mailMessage.Bcc = BccAddress;
}
if (!string.IsNullOrEmpty(ToAddress))
{
ToAddress = ToAddress.Replace(",", ";");
mailMessage.Cc = ToAddress;
}
mailMessage.Subject = EMailSubject;
mailMessage.Body = EMailBody;
if (IsHTMLFormat)
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html;
else
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text;
mailMessage.Priority = System.Web.Mail.MailPriority.Normal;
System.Web.Mail.SmtpMail.SmtpServer = "127.0.0.1";
System.Web.Mail.SmtpMail.Send(mailMessage);
mails will be sent from the user who ever sends.
but the problem is what ever email have added to Bcc are not sent and rest from and cc are working fine.
this is very important to me because we intend to stop release because of this.
any solution would be highly appreciated.
|
|
|
|
|
Can you please Reformat your code ?
Please put your code inside CODE Block Or PRE Tag. Like below,
Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration("~/Web.config");
MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
if (mailSettings != null)
{
port = mailSettings.Smtp.Network.Port;
host = mailSettings.Smtp.Network.Host;
password = mailSettings.Smtp.Network.Password;
username = mailSettings.Smtp.Network.UserName;
}
Which makes the question clear and easily readable. Its very much confusing to check your code and your problem statement inside your code block.
Thanks !
|
|
|
|
|
Hi, i have reformated my question, seems clear now.
|
|
|
|
|
hi iam having fields int the table
branchid nvarchar(50) primary key,
branchname nvarchar(50),
city nvarchar(50),
area nvarchar(50),
phoneno nvarchar(25),
mobileno nvarchar(25),
photo image (16)
how to store the image in sql server using asp.net with c# and how to display and delete, update from gridview
|
|
|
|