|
I used a Grid as following
so anyone help me about : How I get the datakeynames(RegionCode,CountryCode)
on GridView2_RowDeleting.....
<asp:GridView id="GridView2" runat="server" AllowPaging="true" GridLines="None" <br />
OnPageIndexChanging="GridView2_PageIndexChanging" <br />
OnSelectedIndexChanged="GridView2_SelectedIndexChanged" OnRowDeleting="GridView2_RowDeleting"<br />
DataKeyNames="RegionCode,CountryCode" ><br />
<Columns><br />
<asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Images/Delete.gif" /><br />
<asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Edit.gif" SelectText="Edit" ShowSelectButton="True"><br />
<ItemStyle HorizontalAlign="Center" Width="20px" /><br />
</asp:CommandField><br />
<asp:TemplateField><br />
<ItemTemplate><br />
<asp:HyperLink ID="HLdetails" runat="server" Text="Description" NavigateUrl='<%# "~/admin/Description.aspx?CCode="+Eval("CountryCode")+"&RCode=" +Eval("RegionCode") %>' Target="_blank" /><br />
</ItemTemplate><br />
</asp:TemplateField><br />
</Columns><br />
<RowStyle BackColor="#EFF3FB" ForeColor="Black" /><br />
<PagerStyle BackColor="PeachPuff" Font-Bold="True" Font-Size="Medium" ForeColor="DodgerBlue" HorizontalAlign="Center" /><br />
<HeaderStyle BackColor="DodgerBlue" Font-Bold="False" ForeColor="White" /><br />
<AlternatingRowStyle BackColor="AliceBlue" ForeColor="DarkBlue" /><br />
</asp:GridView>
thanx in advance
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Hi Deepak,
Its so simple to delete a particular row using GridView_RowDeleting command using cell index,its good to use DataKeyName when your gridview has two deletebutton column. here i am giving code to delete row on basis of cell index. if you want code of datakeyname then tell me.
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs)
Dim i As Integer = CInt(GridView1.Rows(e.RowIndex).DataItemIndex)
Dim rgncode As String = (GridView2.Rows(i).Cells(indexof regioncode column).Text).ToString
Dim cntrycode As String = (GridView2.Rows(i).Cells(index of countrycode column).Text).ToString
'Your delete command code gone here
GridView1.DataSource = 'name of datasource'
GridView1.DataBind()
End Sub
prabhakar
|
|
|
|
|
i have only one delete button but i use a group primary Keys(regionCode,countryCode)
now i want to write a delete method with delete statemants and use this datakeynames values in Where condition....
that is my motto for doing that prrticular.....
thnx for ur help but i want to need more detail....in C# ASP.net
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Ok, tell me you want to do this by using any datasource control or programatically.
prabhakar
|
|
|
|
|
<asp:GridView id="GridView2" runat="server" AllowPaging="true" GridLines="None" <br />
OnPageIndexChanging="GridView2_PageIndexChanging" <br />
OnSelectedIndexChanged="GridView2_SelectedIndexChanged" OnRowDeleting="GridView2_RowDeleting"<br />
DataKeyNames="RegionCode,CountryCode" CellPadding=5 >
<Columns><br />
<asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Images/Delete.gif" /> <asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Edit.gif" SelectText="Edit" ShowSelectButton="True">
<ItemStyle HorizontalAlign="Center" Width="20px" /><br />
</asp:CommandField><br />
<asp:TemplateField><br />
<ItemTemplate><br />
<asp:HyperLink ID="HLdetails" runat="server" Text="Description" NavigateUrl='<%# "~/admin/Description.aspx?CCode="+Eval("CountryCode")+"&RCode=" +Eval("RegionCode") %>' Target="_blank" />
</ItemTemplate><br />
</asp:TemplateField><br />
</Columns><br />
<RowStyle BackColor="#EFF3FB" ForeColor="Black" /><br />
<PagerStyle BackColor="PeachPuff" Font-Bold="True" Font-Size="Medium" ForeColor="DodgerBlue" HorizontalAlign="Center" />
<HeaderStyle BackColor="DodgerBlue" Font-Bold="False" ForeColor="White" /><br />
<AlternatingRowStyle BackColor="AliceBlue" ForeColor="DarkBlue" /><br />
</asp:GridView>
above code for my grid view
it's bind programatically....
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Hi,
What is the difference between Server.Transfer and Response.Redirect?
If possible please explain me with example.
Thanks to All in Advance.
|
|
|
|
|
difference between Server.Transfer and Response.ReDirect
1) Such as--Server.Transfer can not be used to go to a page of a different website whereas Response.Redirect can do.
2) Response.Redirect can be used for both .html and .aspx pages but Server.Transfer works only for aspx pages.
3) Response.Redirect needs a extra round trip...
Server.Transfer doesn't tell the browser to request page default2.aspx. It just sends page default2.aspx, so e.g., browser address bar still shows the original page's URL.
Response.Redirect sends message to browser saying that the browser should request some other page so basically it means that:
1. Browser is on page default1.aspx on which there is a Response.Redirect("") command which means that the server sends response (message) to browser that browser should request some other page default2.aspx
2. Browser sends request to server in order to get this page default2.aspx
3. Server sends page default2.aspx to browser
Roundtrip:
Roundtrip is the combination of a request being sent to the server and response being sent back to browser.
Request is the message that the browser sends to the server and Response is the message the server sends back to the browser.
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
|
one more....
Response.Redirect does not transfers the query string values and form values of the current page.
Server.Transfer allows you to transfer the query string values and form variables to other page. Best way to transfer values from one page to another using the preserveForm parameter of the Server.Transfer method.
Regards John
|
|
|
|
|
Hi,
What is the difference between Server.Transfer and Response.Redirect?
If possible please explain me with example.
Thanks to All in Advance.
|
|
|
|
|
|
There is very good description just one thread above this one given by Deepak see that
|
|
|
|
|
How to create an assembly in Asp.Net 2.0?
|
|
|
|
|
Automatically created, shoul not create it by yourself.
|
|
|
|
|
You need to publish the web applicaiton, this will precompile the code for you and keep it in the destination folder show in the publish dialog box.
Regards
|
|
|
|
|
Hi All
I need to create a Logout page in my application i am using VB as lang. I works fine but only problem is its ask for a message ...its tyring to close the current window in case of i-explores if we press yes it closes the window and logout page is only open with no back button activated. In case of Mozilla it directly open a new window(the logout page)and project window remains open.
What to do Pl help
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Hi Prakase,
You can use this code, it works fine
Protected Sub lnkLogOut_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkLogOut.Click
Response.Redirect("~/SignOut.aspx")
FormsAuthentication.SignOut()
End Sub
prabhakar
|
|
|
|
|
Hi All.
Help me please to find or write a trigger for UpdatePanel. It must refreshing my UpdatePanel when data in database (SQL Server 2005) is changing.
If You know, how implement this function (refreshing UpdatePanel's content on data changing in database) in another way - I will be glad to get it to know.
Thanks.
|
|
|
|
|
Hi,
Through caching we can do it. We can also do it by setting some properties of ObjectDataSouce control. So Try
prabhakar
|
|
|
|
|
Thank You for answer. You have greatly helped me
|
|
|
|
|
I want to add a delegate to each listbox (10 of total on one page), in order to handle selectedIndexChanged event as following:
lstbox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged);
private void OnSelectedIndexChanged(object sender, EventHandler e)
{
}
I got error like this:
Error 1 No overload for 'OnSelectedIndexChanged' matches delegate 'System.EventHandler'
Can some one help me.
Or any suggestion on what's the best way to handle 10 data list on one page. (display and editable).
Thank you in advance.
|
|
|
|
|
Hi Im working on a student project.
It is a shopping cart application using asp.net and C#. I need to track orders submitted by customers.
When a customer submits an order it is shipped to her address using ny courier service.An id will be returned by courier service that will be used to track the order.Som1 told me dat webservice will be used to do this.I dont know how 2 use web services.
Kindly give me code for above mentioned procedure as soon as possible.
|
|
|
|
|
lastFarhi wrote: Som1 told me dat webservice will be used to do this.I dont know how 2 use web services.
You would help yourself if you spoke English here.
Google has tons of info on web services, they are kind of trivial to use.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am wondering how to add a attribute to an ASP control so that the attribute will show up in the HTML when it is rendered
|
|
|
|
|
Control1.Attributes.Add(string key, string value);
Pretty simple.
|
|
|
|