|
I am working with a page which needs to change it's language by user decission, so I created the Local Resources and I want link the language to an imageButton with the country flag, and I change the Culture data inside the button click event and overrides the InitializeCulture Method, and it works, but because InitilizeCulture executes before than the click event it needs two clicks for getting the page change, my InitializeCulture method contains the following sentences:
protected override void InitializeCulture()
{
if (Session["Cultura"] != null)
{
Cultura = (string)Session["Cultura"];
UICulture = Cultura;
if (Cultura == "es") Culture = "es-ES";
Thread.CurrentThread.CurrentUICulture = new CultureInfo(Cultura);
}
base.InitializeCulture();
}
What I need to introduce in order to avoid the double click, because the execution order normally is InitializeCulture - Page_Load - Button_click, and if I directly call the InitializeCulture from the Button_Click it doesn't refresh th screen.
Best Regards
|
|
|
|
|
A simple hack would be to redirect back to the same page in the click handler.
|
|
|
|
|
I don`t understand your meaning for "a simple hack" but my problem is that InitializeCulture executes before than Button_click so the first click on the button first execute the InitializeCulture before the culture has changed (Session["Culture"]) and the second click just really change the page, but how to do it in only one click.
|
|
|
|
|
Hi,
i propose to move the code that update the Session["Cultura"] to code block of Button_Click and let the InitializeCulture() do it is job by setting the CurrentUICulture.
Regards,
Jamil
|
|
|
|
|
Hi,
I am new to C# and I have a LinkButton inside a gridview. I have been trying to set the myLinkButton.Visible property true or false depending on a database entry.
Here is the code behind I have been working on:
protected void gvBalance_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton MyButton = (LinkButton)e.Row.FindControl("lbPayStatement");
if (Status.Text == "PaymentType1")
{
MyButton.Enabled = false;
}
else
{
MyButton.Enabled = true;
}
}
It gives me errors:
'System.Web.UI.WebControls.GridViewCommandEventArgs.Row' is inaccessible due to its protection level
The property or indexer 'System.Web.UI.WebControls.GridViewCommandEventArgs.Row' cannot be used in this context because the get accessor is inaccessible
I tried making the method "public" and so on , it didn't help. What am I doing wrong? Is there an easier way to access a LinkButton "id" inside a gridview?
Thanks in advance.
~Kaan
|
|
|
|
|
mtataric wrote: gvBalance_RowCommand
Please check which event you are using to do so.
If Gridview then RowDataBound and if DataGrid then ItemDataBound event is the one where you need to write your code to get the link button and then set it's visibility based on certain conditions.
|
|
|
|
|
|
Please dont post the same question at multiple forums. It's considered rude. Choose one that fits best and follow up there.
As suggested:
Since you are asking a question based on one of the code project artiles, we would suggest you to please use the forum present at the end of the article in order to reach author and get quick response.
UPDATE: Have a look at this article: Setting up a Google Map with Information Window[^]
modified on Wednesday, June 9, 2010 2:14 PM
|
|
|
|
|
.progress
{
display: block;
position: absolute;
padding: 2px 3px;
}
.container
{
border: solid 1px #808080;
border-width: 1px 0px;
}
.header
{
background: url(../Images/sprite.png) repeat-x 0px 0px;
border-color: #808080 #808080 #ccc;
border-style: solid;
border-width: 0px 1px 1px;
padding: 0px 10px;
color: #000000;
font-size: 9pt;
font-weight: bold;
line-height: 1.9;
font-family: arial,helvetica,clean,sans-serif;
}
.body
{
background-color: #f2f2f2;
border-color: #808080;
border-style: solid;
border-width: 0px 1px;
padding: 10px;
}
|
|
|
|
|
What is your question ??
I think you forgot to post the question.
Please read this[^] post before you post question.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
function onUpdating()
{
// get the update progress div
var pnlPopup = $get('<%= this.pnlPopup.ClientID %>');
// make it visible
pnlPopup.style.display = '';
// center of gridview
var x = (window.screen.width/2) - (75 + 10);
var y = (window.screen.height/2)- (100 + 50);
// set the progress element to this position
Sys.UI.DomElement.setLocation(pnlPopup, x, y);
}
function onUpdated()
{
// get the update progress div
var pnlPopup = $get('<%= this.pnlPopup.ClientID %>');
// make it invisible
pnlPopup.style.display = 'none';
//when we page we have to call this to make the page scroll
}
<AjaxToolkit:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server"
TargetControlID="updatePanel1" BehaviorID="UpdatePanelAnimationExtender1"
Enabled="True">
<Animations>
<OnUpdating>
<Parallel duration="0">
<%-- place the update progress div over the gridview control --%>
<ScriptAction Script="onUpdating();" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<%--find the update progress div and place it over the gridview control--%>
<ScriptAction Script="onUpdated();" />
</Parallel>
</OnUpdated>
</Animations>
</AjaxToolkit:UpdatePanelAnimationExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="progress"
Style="display: none;" meta:resourcekey="pnlPopupResource1">
<div class="container">
<div class="header">
Loading, please wait...</div>
<div class="body">
<img src="../Images/activity.gif" alt="" />
</div>
</div>
</asp:Panel>
|
|
|
|
|
1) What's your question?
2) Please put that between pre tags. If it's erroring on a specific point then please provide the exception message.
|
|
|
|
|
|
geeeeeeeetha wrote: in that webmethod i mentioned enablesession=false
Where did you mentioned it ? In your given code block its not there. And If you don't want to enable session in web method, you do not need to mention the EnableSession=false, becuase this is the default value.
Not Sure, why some one marked it as bad question !!
|
|
|
|
|
Hi all,
Please help me out on this.
I’m viewing the stock in my gridview from the database. I have Item name, quantity, and price in my gridview. The last column contains two radio buttons (with GroupName property) with names “Buy” and “Decline”. I have to select one radio button per row and after selecting all that I want to buy I have to calculate the total. I have a calculate button at the bottom.
Firstly, I don’t have a clue on how to get the value of the selected radio button from the gridview so that I can get all the prices (and add them up) where the “Buy” radio button is selected.
Please advise on how can achieve all this.
Thank you in advanced.
|
|
|
|
|
In your Calculate button event try something like:
foreach (DataGridItem dgItem in myDataGrid.Items)
{
HtmlInputRadioButton rBuyButton = dgItem.FindControl("buyRadioButtonInGrid") as HtmlInputRadioButton;
if (rBuyButton.Checked)
{
}
else
{
}
}
|
|
|
|
|
Thanks a lot for the advise.
I’m using asp radio buttons, I modified the code accordingly. My problem with these radio buttons is, after selecting e.g “Buy” radio button and then click Calculate button, my radio button becomes unchecked and that leads to not getting the value of that radio button. What have I done wrong?
Calculate button code:
protected void btnCalculate_Click(object sender, EventArgs e)
{
foreach (GridViewRow dgItem in gridViewBill.Rows)
{
RadioButton rBuyButton = dgItem.FindControl("rdbBuy") as
RadioButton;
if (rBuyButton.Checked)
{
//Some Code for Buy
Label1.Text = rBuyButton.Text;
}
else
{
// Some code for Decline
}
}
}
This is my Gridview code:
<asp:GridView ID="gridViewBill" runat="server" HeaderStyle-Font-Bold="true" AllowPaging="True"
PageSize="3" Width="728px">
<HeaderStyle Font-Bold="true" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:RadioButton ID="rdbBuy" runat="server" Text="Buy" GroupName="options" />
<asp:RadioButton ID="rdbDecline" runat="server" Text="Decline" GroupName="options" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
It creates the table and loads the data from the database. How can I get each value of the “Price” column per row?
Thanks.
|
|
|
|
|
Hello Everyone
Myself Gaurav Gupta actually i would like to discuss that i want to upload the compiled code(by publish the website) which is made in asp.net2.0 to our web server .actually we have a domain www.xyz.com and i want to make a folder on root like icmm now i want to copy all the compiled code in that folder. but when run the application this message show."This is a marker file generated by the precompilation tool, and should not be deleted!"
Please tell me is it possible to upload the complete comiled code to upload in a folder or where i should upload bin folder.
Thanks
Gaurav Gupta
|
|
|
|
|
How did you complied and host your code ?
Do you have ASP.NET Framework installed on the Server where you have hosting your site ? If yes, does it registred with IIS ?
Below check the above two things that I have mentioned.
You may read this article :
Site pre-compilation in ASP.NET 2.0[^]
|
|
|
|
|
Hi Mr. Abhijit
Thanks for the reply.Actually i compiled by publish the website and host my compiled code on our webhosting company's server in a folder which is at the root of the website .
Yes all the setting is there on the server. I had a doubt that how to upload a code in subfolder. Like as the website is www.xyz.com/icmm_2010/abc.aspx.
I want all access all the pages in a folder(icmm_2010) which is on the root of the website.
Thanks
Gaurav
|
|
|
|
|
Is it possible to develop email piping on windows using asp.net or classic asp (C# or vb.net) and plesk, helm or any other control panel? If yes?How?
Thanks in advance.
|
|
|
|
|
Friends12 wrote: email piping on windows using asp.net or classic asp
What do you mean by that ?
|
|
|
|
|
How can I integrate asp.net and plesk?
|
|
|
|
|
hi all,
my problem is i stored data in viewstate when i click on another click event in same page view state is cleared....
i need create static viewstate,how?
how to solve this problem?
|
|
|
|
|
You can store your viewstate information in page cache or in session.
Because viewstate is reinitialized when page_load occurs.
Use
Page.Cache["name"]=value;
or
Session object to store your value.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|