What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 7698 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > entry and edit mode in same form ...
Shailesh21235

entry and edit mode in same form

Replies: 4 | Posted by: Shailesh21235 on 7/3/2012 | Category: ASP.NET Forums | Views: 485 | Status: [Member] | Points: 10  


here i have created a mode works on padeload & this classs GetQueryStringValue returns a query;;

stringmode = GetQueryStringValue(HttpContext.Current.Request.QueryString["Mode"]);
string productId = GetQueryStringValue(HttpContext.Current.Request.QueryString["ProductID"]);
string temp = "localhost/admin/product.aspx?Mode=Edit&ProductID=1";

if (mode.Equals("Edit")
{}
else (mode.Equals("Insert"))
{}

whle entering in edit mode there is no value so it skips the step...how to enter in these modes to edit or insert datas in same button click????


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Sheonarayan
Sheonarayan  
Posted on: 7/3/2012 9:33:59 PM
Level: HonoraryPlatinum | Status: [Microsoft_MVP] [Administrator] | Points: 25

I feel the code you have written is not proper. Instead of having the mode in querystring you can store some flag in the ViewState and use this to decide edit or insert mode.

Even you use above code, I really do not understand what GetQueryStringValue is doing there as you have already passed the exact code to retrieve the querystring. Perhaps you just need to pass "Mode" in this method and it will return you the querystring value.

Hope this helps.

Thanks

Regards,
Sheo Narayan, Microsoft MVP
The Founder
http://www.dotnetfunda.com

Shailesh21235, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Muralidosscm
Muralidosscm  
Posted on: 7/4/2012 1:28:55 AM
Level: Starter | Status: [Member] | Points: 25

if (mode.Equals("Edit")
{}
else (mode.Equals("Insert"))
{}

if else condition is wrong............

put the code clearly


Regards
Muralidoss M

Shailesh21235, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Perfect.Chourasia@Gmail.Com
Perfect.Chourasia@Gmail.Com  
Posted on: 7/4/2012 2:11:44 AM
Level: Starter | Status: [Member] | Points: 25

int pageid = Convert.ToInt32(Request.QueryString["Mode"].ToString().Trim());
if (mode.Equals("Edit")
{
//Execute query and save in dataset
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, "select *,(cast(regionID as varchar) +','+ cast(countryId as varchar) +','+ cast(cityid as varchar)) as id from vwDestinationLocation order by location");

//Fill the input boxes
txtWDesc.Value = dsContent.Tables[0].Rows[0]["WeatherDesc"].ToString();
txtHDesc.Value = dsContent.Tables[0].Rows[0]["HistoryDesc"].ToString();
txtVdesc.Value = dsContent.Tables[0].Rows[0]["VisitDesc"].ToString();

// After this run the update query.

}
else (mode.Equals("Insert"))
{
//here run the insert query.

}


ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://sandeep-chourasia.blogspot.com/

Shailesh21235, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Shailesh21235
Shailesh21235  
Posted on: 7/4/2012 2:11:44 AM
Level: Starter | Status: [Member] | Points: 25

hey thanks,
but is it possible to enter in edit or insert mode in page load or can be done only by button press in product.aspx page????

i have done done in the page just by pressing edit or insert button.......

how to direct it to the modes in pageload.....

Shailesh21235, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/26/2013 4:39:36 AM