|
Yes this is it Here is my 5
|
|
|
|
|
Hi,
I want to save the session UserName in a table using mysql.
I have the history of my base table(auction) update, delete, create information will get stored in a backup table(auction_log). I want to save username(who currently loged in and modifies the record in a table) in too the auction_log table.
reg,
Subbu
|
|
|
|
|
And what part are you having difficulties with?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Create a connection to mysql db and run an insert or update on the table.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Pass the username as a parameter to a stored procedure and insert the new record as:
insert into auction_log (field1, field2, ..., UserName)
values (@Field1, @Field2, ..., @UserName)
or similar should do it. It's been a while since I used MySql but I think that should work.
|
|
|
|
|
Hi
In my page am using ajax calendar and other ajax controls. All the pages were developed on visual studio platform and last month we linked all the pages to sharepoint. Till yesterday all the pages were working fine. But all of a sudden, now the pages that are using ajax controls are throwing error.
The control with ID 'CalExTfdate' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
When i checked the code, script manager is present in the aspx page. Any guess where it went wrong for the pages to throw error.
Thanks in advance
Naina
Naina
|
|
|
|
|
Put your ScriptManager before any other control in your page.
Are you writing your javascript functions in html head tag?
If so, try to move all your javascript code just before where your body tag ends.
Hope this will resolve your problem.
|
|
|
|
|
Anurag Gandhi is Right.The ScriptManager should be always appear before the control that you want to use that is Ajax related, usually we put it in the master page so that it can be available for all controls.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks for the replies... i have already scriptmanager in the page. And wonder is it was running till morning and all of a sudden the error started. Naina
|
|
|
|
|
can you post the markup of your page and we will point out the problem. Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi
I have a stored procedure which returns first name, lastname and id of an employee
Now this result has become a datasource for my dropdownlist
what i want to do is in the textfield, i want to display in the below format
firstname lastname [id]. I want to do this in front end only not in procedure. Kindly help me how to do this?
Regards
Naina
Naina
|
|
|
|
|
There are many ways of doing so.
1. You can populate your drop down something list like this:
foreach(DataRow row in myDataTable.Rows)
{
string text = row["FirstName"].ToString() + " " + row["LastName"].ToString() + " [" + row["Id"].ToString() + "]";
DropDownList1.Items.Add(new ListItem(text, row["Id"].ToString()));
}
2. You can use linq projection on the dataTable and use teh linq query result as your DropDownList datasource.
Hope this will help.
|
|
|
|
|
Thanks for your reply.... I got it.
Naina
|
|
|
|
|
Hi
I am having one more prob.... when selecting the item from dropdown , i want only the firstname from ddl.SelectedItem.Text
Naina
Naina
|
|
|
|
|
You can get firstname by just splitting ddl.SelectedItem.Text
|
|
|
|
|
Instead of adding the ID to the listItem value, add the first name as below:
foreach(DataRow row in myDataTable.Rows)
{
string text = row["FirstName"].ToString() + " " + row["LastName"].ToString() + " [" + row["Id"].ToString() + "]";
DropDownList1.Items.Add(new ListItem(text, row["FirstName"].ToString()));
}
and then retrieve this, rather than the text using:
ddl.SelectedItem.Value
|
|
|
|
|
This is better approch
|
|
|
|
|
Hi
I have a link button which is part of my user control. Further, the control is actually added to the control dynamically. Whilst, I can see the control, and is added to the page without any visible errors, but when I click on to fire an event which on that user control nothing happens. What is even more odd, if I add a break point to event, and then click in debug mode, I can't even reach the break point!
To try and resolve this, I have tried giving the link button ids, and ensured they unique, added override using OnInit and used the createchildcontrols method, but nothing seems to work!
Has anyone came across and if so, can give me a solution?
|
|
|
|
|
Where in the code is the linkbutton created dynamically? Put a breakpoint on page_load and you should see that this is hit when you click the linkbutton. It doesn't fire the event because the control is not recreated again as part of the postback.
Try recreating the control in page_load if isPostBack = true. Remember to recreate your event handler here as well.
|
|
|
|
|
Hi
I had already done all of this.
The linkbutton is created on the usercontrol form.
I have added the linkbutton creation to, with this.linkbutton1.click += EventHandler(this.linkbutton1_click); to Page_Load, OnInit, Page_PreRender and CreateChildControls.
The event will not fire even after doing all of this!
|
|
|
|
|
Could you post the code behind please?
|
|
|
|
|
As you said the Link button is created Dynamically, you have to create it Every Time when the page is post back, also create it in the Init event of the user control.
|
|
|
|
|
Here is the user control with the link button on it!
public partial class ucCustomerDetails : System.Web.UI.UserControl
{
protected override void CreateChildControls( )
{
base.CreateChildControls( );
this.lnkShowAllCust.ID = "lnkShowAllCust";
this.lnkShowAllCust.Click += new EventHandler(this.lnkShowAllCust_Click);
this.Controls.Add(lnkShowAllCust);
}
protected override void OnInit (EventArgs e)
{
CreateChildControls( );
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
base.EnsureChildControls( );
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
CreateChildControls( );
}
}
protected void lnkShowAllCust_Click(object sender, EventArgs e)
{
this.OnCustShowAllClicked(new EventArgs ( ));
}
protected virtual void OnCustShowAllClicked(EventArgs args)
{
if (this.ViewAllClicked != null)
{
this.ViewAllClicked(this, args);
}
}
public event EventHandler ViewAllClicked;
}
I have deleted other stuff that is on it, but these other controls have nothing to do with the link button
|
|
|
|
|
Here is the user control with the link button on it!
public partial class ucCustomerDetails : System.Web.UI.UserControl
{
protected override void CreateChildControls( )
{
base.CreateChildControls( );
this.lnkShowAllCust.ID = "lnkShowAllCust";
this.lnkShowAllCust.Click += new EventHandler(this.lnkShowAllCust_Click);
this.Controls.Add(lnkShowAllCust);
}
protected override void OnInit (EventArgs e)
{
CreateChildControls( );
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
base.EnsureChildControls( );
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
CreateChildControls( );
}
}
protected void lnkShowAllCust_Click(object sender, EventArgs e)
{
this.OnCustShowAllClicked(new EventArgs ( ));
}
protected virtual void OnCustShowAllClicked(EventArgs args)
{
if (this.ViewAllClicked != null)
{
this.ViewAllClicked(this, args);
}
}
public event EventHandler ViewAllClicked;
}
I have deleted other stuff that is on it, but these other controls have nothing to do with the link button
|
|
|
|
|
Try following code:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
LinkButton lnk = new LinkButton();
lnk.Text = "My Link";
lnk.Click += new EventHandler(lnk_Click);
plcHld.Controls.Add(lnk);
}
void lnk_Click(object sender, EventArgs e)
{
lblMessage.Text = "Link Clicked";
}
|
|
|
|