|
Hi all,
I am designing my program like this. I am having a text box, button and a grid view on my page. When i entered some value in text box and click on button the value is binding to grid view. In the grid view i am having only one field as Name and option as select. When i click on select i am displaying the corresponding user in the text box. What i need is if i edit the text on the text box and click on the same button again the value should replace the old one.
Example
TextBox -----------
Button
Gridview
Name
Dora select
Xyz Select
When i click on select at xyz i am displaying it in text box. If i would like to replace it with some name like ABC what to do.. Please help me..
|
|
|
|
|
|
Yes ... It is trivial... First of all let me know are you storing the data into database ?
If the data is in the database, just update the value when user clicks on the button after updating the data, and rebind the Gridview to reflect the update.
|
|
|
|
|
How can I show additional button in a gridview cell based on another cell value.I am using asp.net and c#.
I have ON or OFF values in a GridView cell. Based on this value I want to show a button (opposite Toggle (OFF/On) correspondingly) in another cell.
This is my code.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells[2].Text== "0")
e.Row.Cells[2].Text = "OFF";
else
e.Row.Cells[2].Text = "ON";
}
please help.
Thank You
|
|
|
|
|
Are you looking for UnBound TemplateField ?
Simply add
<asp:TemplateField HeaderText="Mode">
<ItemTemplate>
<asp:Button runat="server"
Text="<%!Convert.ToBoolean(Eval("Toggle")) %>" CommandName="ToggleClick"
CommandArgument='<%#Eval("Toggle") %>/>
</ItemTemplate>
</asp:TemplateField>
and use OnRowCommand to handle this event.
|
|
|
|
|
thanks for the reply,
but there is something wrong with this code.
Can u recheck it plz?
Thank You
|
|
|
|
|
Yes.. Actually I have written this directly.. Not tried out.... Can you let me know what error you are getting ... ?
Well, Eval("field") should be changed with your valid database field ??
Also change the fieldnames according to the datasource you bound to.
|
|
|
|
|
Actually I am using it as a TemplateField. It's value is not coming from database.
what can be the solution?
Thank You.
|
|
|
|
|
Then Just place True / false instead of Eval statement..
|
|
|
|
|
I have written this. theres is some problem. It shows "Convert.ToBoolean(true)".
What is the problem?
<asp:TemplateField HeaderText="Mode">
<ItemTemplate>
<asp:Button runat="server" Text="<%!Convert.ToBoolean(true) %>" CommandName="ToggleClick" CommandArgument=<%#true %>/>
</ItemTemplate>
</asp:TemplateField>
Thank You
|
|
|
|
|
No no.. write this...
<asp:TemplateField HeaderText="Mode">
<ItemTemplate>
<asp:Button runat="server" Text="True" CommandName="ToggleClick" CommandArgument="True" />
</ItemTemplate>
</asp:TemplateField>
In CommandArgument you need to specify what you want to pass to the event generated when button is clicked. I have placed true there, which is not required. Replace appropriate element there (I mean the field which might be dependent on the button)
|
|
|
|
|
Hi..,
i need to fire an event when double clicked on a listbox control.
|
|
|
|
|
|
currently i m using asp.net 2.0 with sqlserver 2000.
here two tables playing the role. Table "A" and "B". 5 records to be inserted into the "A". after 1st record inserted in "A", the autoid has to be used for the "B" table's column value.
Is it possible using TRANSACTION? (i m not using any store procedure or triggers......only simple insertion).. help me
- Karan
|
|
|
|
|
I do not really understand what you what. Do you mean something like this pseudo-code?
begin
start transansaction
insert into a (somevalues)
insert into b (select @@id from [last insert into a])
insert into a (somevalues)
insert into b (select @@id from [last insert into a])
insert into a (somevalues)
insert into b (select @@id from [last insert into a])
insert into a (somevalues)
insert into b (select @@id from [last insert into a])
insert into a (somevalues)
insert into b (select @@id from [last insert into a])
if(anyerror)
rollback()
else
commit()
end
Greetings
Covean
|
|
|
|
|
EXACTLY!! how can i achieve it? is it possible to fetch the autoid? since we using the transaction. so once all the process are ok, then only it will get commit.... help me.
|
|
|
|
|
|
At first to get the auto generated id your statement has to look like this.
(I'm working with SQL-Server 2005 and 2008, don't know if it works on older versions).
SET NOCOUNT ON; INSERT INTO tableName(ColumnA, ColumnB,...) VALUES(...); SELECT @@IDENTITY AS ID;
This statement turns the row counter off and selects after the insert the new generated id )instead of the row count). Now you can use ExecuteScalar to get the new generated id.
And to start an transaction look for example at the class OleDbTransaction its very easy to understand.
If have a little of time, but if you need I can post a little bit of source code for that.
Greetings
Covean
|
|
|
|
|
Hi All,
I have an ASP.Net web application. Users are able to access this application through internet as well as through intranet (LAN). My requirement is like this - The web page should show different welcome messages for Internet user and Intranet (LAN) user. Is there any way to do that in ASP.Net?
Thanks in Advance.
SoftwareDeveloper(.NET)
|
|
|
|
|
Why Dont You compare the ip address of yours and the clients ..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi Sashidhar,
Thanks much for your quick reply. Let me please go in to more details of the requirement. You are right we can compare if the LAN access IP is one in the case. In our case we need to deploy the application to many client sites, there again the LAN ip would be different. We have thought about keeping a configuration in the table to identify the known ips and assuming all other requests are from internet..But intead of taking that way , would like to know any easiest or simple way in .Net to identify the request. I mean to distinguish it to LAN or internet. It would be nice to learn that information if we have any options. And If we get a confirmation that there is no direct way then can proceed in the alternate..
Thanks.
SoftwareDeveloper(.NET)
|
|
|
|
|
Siju-T wrote: In our case we need to deploy the application to many client sites,
We Can get the main Ip Address i.e.parent.So If You deploy any where, Asp.net can return the parent address so there is No problem where you deploy it.As long as it is deployed in their own productions..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Ok..Suppose if we got the ip. From that how can find out the request came through internet or intranet. Hardcoding ip is not possible unfortunately per requirement. More over the module is a generalized module and will be used in many different applications and clients. if we need to hard code and track the ip for each client it would be little difficult..But that would be the last option..The important thing is not to take another way to reach the destination. It would be nice if we get an information that whether it is possible or not. I mean is there any method can find out the request is from internet or intranet. But if you can confirm that , the way is not possible to find out then we can take the other route. But really curious to know whether it is possible or not in .Net.
Thanks.
SoftwareDeveloper(.NET)
|
|
|
|
|
My Friend First Listen..!
You have an application which is deployed in host .i.e. In Your Company with parent Ip address.xxx.xxx.xxx.xxx
The People who are working in your company will have the same parentIp address.
So what is the problem in that.
Dont think too much..!
Its an easy One You can do it..!
all the best..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Sashidar,
I am bit confused now..sorry I cannot pick your solution.
Here is my doubt.
Client machine send a request to the Server. In server how we can get the client's parent ip. Similarly it would be nice if you can share a code snippet or psuedocode etc.
Thanks.
SoftwareDeveloper(.NET)
|
|
|
|